Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

chai-jasmine

2.0.3 • Public • Published

chai-jasmine

Build Status

chai-jasmine is an extension which provides Jasmine's style expect on top of mocha using chai assertion library.

Installation

npm install chai-jasmine --save-dev;

Usage

node:

require('chai-jasmine');

browser:

<script src="vendor/mocha/mocha.js" type="text/javascript"></script>
<script src="vendor/chai/chai.js" type="text/javascript"></script>
<script src="vendor/chai-jasmine/chai-jasmine.js" type="text/javascript"></script>

This implementation is based on Jasmine's core directly so all Jasmine's features are supported out of the box :

  • Focusing specs
  • Spies
  • Clock
  • Mocking Date
  • Asynchronous (with the done() function, Jasmine >= 2.0).

Jasmine's matchers has been rewriten to work on top of chai so features like the Jasmine's custom equality testers won't work anymore. Moreover you'll need to rewrite all your Jasmine custom matchers using chai and include them like so to make them work:

var chai = require('chai-jasmine');
chai.use(require('./your-custom-matchers'));

Note: all features related to the Jasmine's specs runner (like Jasmine.Env()) or reporting won't have any effect anymore.

Note: spies are now cleared up during afterEach() which may changes a bit the spiecs persistance behavior over specs.

Keywords

none

install

npm i chai-jasmine

Downloadsweekly downloads

73

version

2.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability