https://github.com/kevicency/karma-sinon-chai
Karma + Mocha + Sinon + Chai = ❤
https://github.com/kevicency/karma-sinon-chai
Last synced: 9 months ago
JSON representation
Karma + Mocha + Sinon + Chai = ❤
- Host: GitHub
- URL: https://github.com/kevicency/karma-sinon-chai
- Owner: kevicency
- License: mit
- Fork: true (xdissent/karma-chai)
- Created: 2013-08-02T09:39:56.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2021-11-05T18:17:17.000Z (over 4 years ago)
- Last Synced: 2025-01-10T03:23:40.024Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 47.9 KB
- Stars: 86
- Watchers: 5
- Forks: 43
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://badge.fury.io/js/karma-sinon-chai) [](https://david-dm.org/kmees/karma-sinon-chai) [](https://david-dm.org/kmees/karma-sinon-chai#info=devDependencies)
karma-sinon-chai
================
* [Sinon](http://sinonjs.org/)
* [Chai](http://chaijs.com)
* [Sinon-Chai](https://github.com/domenic/sinon-chai)
for [Karma](http://karma-runner.github.io)
Requirements
------------
This Karma plugin requires Karma `>=0.10`
Installation
------------
Install the module via npm
```sh
$ npm install --save-dev karma-sinon-chai
```
Add `sinon-chai` to the `frameworks` key in your Karma configuration:
```js
module.exports = function(config) {
'use strict';
config.set({
frameworks: ['mocha', 'sinon-chai'],
# chai config
client: {
chai: {
includeStack: true
}
}
#...
});
}
```
Usage
-----
Each of the different Chai assertion suites is available in the tests:
```coffee
describe 'karma tests with chai', ->
it 'should expose the Chai assert method', ->
assert.ok('everything', 'everything is ok');
it 'should expose the Chai expect method', ->
expect('foo').to.not.equal 'bar'
it 'should expose the Chai should property', ->
1.should.not.equal 2
should.exist 123
```
Sinon and Chai matchers for Sinon are also available:
```coffee
describe 'karma tests with sinon', ->
it 'can spy on objects', ->
foo = bar: ->
sinon.spy foo, 'bar'
foo.bar 'baz'
foo.bar.should.have.been.calledWith 'baz'
```
Changelog
----------------
### v2.0.0
* Removed `lolex` dependency. Please use [Sinon's fake timers](http://sinonjs.org/releases/v4.5.0/fake-timers/) instead, which use `lolex` under the hood.
### v1.1.0
* Fixed broken Sinon dependency
* Updated depenencies
* Chai: `~3.0 => ~3.2.0`
* Sinon: `~1.15.0 => ~1.16.0`
* Removed `lodash` dependency
### v1.0.0
* Updated to broken sinon version. Probably doesnt work :bomb:.