strict-spies
v2.0.2
Published
A strict alternative for Jasmine spies
Downloads
6
Readme
Strict spies
A strict alternative for Jasmine spies. Also works for Chai.
Install
yarn add --dev strict-spies
Usage with Jasmine
Include in your Jasmine setup file that's run before all tests:
import StrictSpies from "strict-spies/jasmine";
beforeEach(function() {
// Initialize spies container for each test run.
this.spies = new StrictSpies();
// Register Spies-specific assertions to be used instead of Jasmine built-in spy-assertions
jasmine.addMatchers(StrictSpies.assertions);
});
Usage with Chai
Add to your Mocha setup file:
import chai from "chai";
import StrictSpies from "strict-spies/chai";
// Register Spies-specific assertions
chai.use(StrictSpies.assertions);
beforeEach(function() {
// Initialize spies container for each test run.
this.spies = new StrictSpies();
});