npm.io
2.0.2 • Published 8 years ago

strict-spies

Licence
MIT
Version
2.0.2
Deps
0
Vulns
0
Weekly
0
Stars
4

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

Keywords