chai-jasmine

2.0.6 • 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.

Readme

Keywords

none

Package Sidebar

Install

npm i chai-jasmine

Weekly Downloads

41

Version

2.0.6

License

MIT

Unpacked Size

832 kB

Total Files

102

Last publish

Collaborators

  • jails