Chai browser plugins set for Karma
JavaScript
Switch branches/tags
Latest commit 0ddeb61 May 17, 2017 @princed 🔩 Pin chai-as-promised dependency for David DM's badge as it's imposs…
…ible to update without much effort
Permalink
Failed to load latest commit information.
test chai-dom Nov 13, 2015
.eslintrc ⬆️ Update ESLint Feb 20, 2016
.gitignore .gitignore generated Aug 9, 2013
.npmignore * remove expect-deferred Aug 9, 2013
.travis.yml ⬆️ Actual node versions Sep 17, 2016
LICENSE
README.md 📝 May 15, 2017
appveyor.yml
chai-adapter.js Replace jshint with eslint Apr 2, 2015
function-bind-polyfill.js Replace jshint with eslint Apr 2, 2015
index.js chai-dom Nov 13, 2015
karma.conf.js
package.json 🔩 Pin chai-as-promised dependency for David DM's badge as it's imposs… May 17, 2017

README.md

karma-chai-plugins

Chai browser plugins set for Karma

Dependency Status Greenkeeper badge Current version NPM downloads Travis Build Status AppVeyor Build Status

Installation

Install the karma-chai-plugins:

$ npm install karma-chai-plugins --save-dev

Add chai and plugins you need to the frameworks key in your Karma configuration:

module.exports = (config) ->
  config.set

    # frameworks to use
    frameworks: ['mocha', 'chai', 'chai-as-promised']

    # ...

Bundled plugins

Note: for using sinon, it is sufficient to add sinon-chai in karma frameworks. No need to add sinon.

Browser support

Same as Chai.js: IE 9+, Chrome 7+, FireFox 4+, Safari 5+ except should style that is currently not compatible with IE 9.

Consider karma-expect, if you need run tests in IE8 and lower.

Fair Warning

Currently, in order to use Chai-as-Promised when running tests within PhantomJS, a polyfill for Function.prototype.bind must be supplied. This plugin includes such a polyfill. If your code under test is intended to be run under PhantomJS in production, bear this in mind! You may need to supply your own polyfill in your project.

The Function.prototype.bind polyfill will be removed in the future v1.0 release of karma-chai-plugins.

chai-dom and chai-jquery can't work together, choose one of them.

Limited require.js support

karma-chai-plugins supports requirejs in tests, but for now it should be stated in frameworks before chai and other plugins:

module.exports = (config) ->
  config.set

    # frameworks to use
    frameworks: ['mocha', 'requirejs', 'chai', 'chai-as-promised']

    # ...

Contribution guidelines

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using npm test.