Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
chai-factories
Advanced tools
This is a addon plugin for the Chai Assertion Library.
Chai Factories is a simple straightforward factory builder for your awesome tests.
$ npm install chai-factories
Include chai-factories.js
after including chai.js
.
<script src="chai-factories.js"></script>
If you are using chai-factories
in the browser, there is nothing you need to do. It will detect chai
in the global
namespace and automagically get used.
If you are using node, here is a useful bit.
var chai = require('chai')
, factories = require('chai-factories');
chai.use(factories);
If you are developing an addon for chai, one thing you might find useful is the contents of the support
folder.
This directly contains everything that is needed to package all js files in a directory for browser use. Provided
there are no external dependencies, everything will be packaged and wrapped with a CommonJS require
style loader
by folio, a small JS packaging tool. Please consult the comments in support/compile.js
.
chai.factory('person', { name: 'John Doe', age: 29 });
chai.factory('cat', { name: 'Boo' });
var user = chai.factory('person');
console.log(user);
chai.factory('cat', { cute: true, age: 4 });
var cat = chai.factory('cat', { cute: false });
var cat = chai.factory('cat', { cute: true, age: 4 });
chai.factory('tiger', cat.extend({ scary: true }));
Tests are written using mocha.
Node tests can be executed using make test
. Browser tests can be seen by opening test/browser/index.html
.
(The MIT License)
Copyright (c) Veselin Todorov hi@vesln.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Factories over fixtures. Build for the Chai Assertion Library
The npm package chai-factories receives a total of 200 weekly downloads. As such, chai-factories popularity was classified as not popular.
We found that chai-factories demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.