https://github.com/csantero/ember-sinon
Ember CLI addon adding support for sinon.js
https://github.com/csantero/ember-sinon
Last synced: about 1 year ago
JSON representation
Ember CLI addon adding support for sinon.js
- Host: GitHub
- URL: https://github.com/csantero/ember-sinon
- Owner: csantero
- License: mit
- Created: 2014-11-01T22:32:05.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-12-14T17:21:10.000Z (over 2 years ago)
- Last Synced: 2024-10-09T21:10:04.776Z (over 1 year ago)
- Language: JavaScript
- Size: 668 KB
- Stars: 64
- Watchers: 3
- Forks: 13
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-ember - ember-sinon - Ember CLI addon adding support for sinon.js. (Packages / Testing)
README
Ember Sinon (_Deprecated_)
===========
:warning: **Deprecation notice**: `ember-sinon` is deprecated. Consider using [ember-sinon-qunit](https://github.com/elwayman02/ember-sinon-qunit) instead. :warning:
[](https://greenkeeper.io/)
[](https://travis-ci.org/csantero/ember-sinon)
[](http://emberobserver.com/addons/ember-sinon)
[](https://codeclimate.com/github/csantero/ember-sinon)
[](https://www.codacy.com/app/hawker-jordan/ember-sinon)
This addon adds support for [Sinon](https://github.com/cjohansen/Sinon.JS) to assist in testing your Ember CLI app.
Compatibility
------------------------------------------------------------------------------
* Ember.js v3.12 or above
* Ember CLI v2.13 or above
* Node.js v10 or above
Installation
------------------------------------------------------------------------------
```
ember install ember-sinon
```
Usage
------------------------------------------------------------------------------
While in testing mode (i.e. either when visiting `/tests` or when running `ember test`), `sinon` will be available as an import.
```js
import sinon from 'sinon';
test(".runCallback() should run the callback passed", function(assert) {
var spy = sinon.spy();
this.subject().runCallback(spy);
// Default Sinon messages:
sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, 'foo');
// Custom messages:
assert.ok(spy.calledOnce, "the callback should be called once");
assert.ok(spy.calledWith('foo'), "the callback should be passed 'foo' as an argument");
});
```
## Integration with testing frameworks
Check out [ember-sinon-qunit](https://github.com/elwayman02/ember-sinon-qunit) for integration with Ember-QUnit!
Contributing
------------------------------------------------------------------------------
See the [Contributing](CONTRIBUTING.md) guide for details.
License
------------------------------------------------------------------------------
This project is licensed under the [MIT License](LICENSE.md).