strict-spies

2.0.2 • Public • Published

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();
});

Package Sidebar

Install

npm i strict-spies

Weekly Downloads

0

Version

2.0.2

License

MIT

Last publish

Collaborators

  • nene
  • zeroturnaround