Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/princed/karma-chai-plugins
Chai browser plugins set for Karma
https://github.com/princed/karma-chai-plugins
assertions chai karma karma-plugin sinon
Last synced: 13 days ago
JSON representation
Chai browser plugins set for Karma
- Host: GitHub
- URL: https://github.com/princed/karma-chai-plugins
- Owner: princed
- License: mit
- Created: 2013-08-05T13:16:40.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T08:14:45.000Z (over 3 years ago)
- Last Synced: 2024-10-31T08:52:21.102Z (20 days ago)
- Topics: assertions, chai, karma, karma-plugin, sinon
- Language: JavaScript
- Size: 82 KB
- Stars: 30
- Watchers: 1
- Forks: 20
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
karma-chai-plugins
==================> [Chai](http://chaijs.com) browser plugins set for [Karma](http://karma-runner.github.io)
[![Dependency Status](https://img.shields.io/david/princed/karma-chai-plugins.svg?style=flat-square)](https://david-dm.org/princed/karma-chai-plugins) [![Greenkeeper badge](https://badges.greenkeeper.io/princed/karma-chai-plugins.svg)](https://greenkeeper.io/)
[![Current version](https://img.shields.io/npm/v/karma-chai-plugins.svg?style=flat-square)](https://www.npmjs.com/package/karma-chai-plugins) [![NPM downloads](https://img.shields.io/npm/dt/karma-chai-plugins.svg?style=flat-square)](https://www.npmjs.com/package/karma-chai-plugins) [![Travis Build Status](https://img.shields.io/travis/princed/karma-chai-plugins.svg?style=flat-square)](https://travis-ci.org/princed/karma-chai-plugins) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/princed/karma-chai-plugins.svg?style=flat-square)](https://ci.appveyor.com/project/princed/karma-chai-plugins)Installation
------------Install the `karma-chai-plugins`:
```sh
$ npm install karma-chai-plugins --save-dev
```Add `chai` and plugins you need to the `frameworks` key in your Karma configuration:
```coffee
module.exports = (config) ->
config.set# frameworks to use
frameworks: ['mocha', 'chai', 'chai-as-promised']# ...
```Bundled plugins
---------------* [chai](http://chaijs.com)
* [chai-as-promised](http://chaijs.com/plugins/chai-as-promised)
* [chai-dom](http://chaijs.com/plugins/chai-dom) (do not use with chai-jquery)
* [chai-jquery](http://chaijs.com/plugins/chai-jquery) (jQuery should be included manually)
* [sinon-chai](http://chaijs.com/plugins/sinon-chai) (sinon will be included automatically)
* [chai-things](http://chaijs.com/plugins/chai-things)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](http://chaijs.com/guide/installation/#browser-section): IE 9+, Chrome 7+, FireFox 4+, Safari 5+ except `should` style that is currently not compatible with IE 9.
Consider [karma-expect](https://github.com/princed/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:
```coffee
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`.