Ember Sinon is an Ember CLI addon that seamlessly integrates the Sinon.js testing framework into Ember applications, simplifying the process of creating test spies, stubs, and mocks. The current stable version is 5.0.0, which supports Ember.js v3.16+ and Sinon.js v9.0.0+. Historically, the addon has maintained a consistent release cadence, often aligning its major versions with significant Ember and Sinon updates several times a year. Key differentiators include its tight integration with the Ember CLI test suite, making Sinon globally available in test environments without manual configuration, and its direct compatibility with `ember install` workflows. It offloads the complexity of managing Sinon.js versions and ensuring it's properly hooked into Ember's testing infrastructure, providing a ready-to-use solution for behavior verification in unit and integration tests.
npm install ember-sinonVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use Sinon spies and stubs within an Ember QUnit test to verify function calls and mock asynchronous operations.
Ensure your project's `ember-source` is at least `^3.16.0` and `sinon` is `^9.0.0` in `package.json`, then run `npm install`.
Upgrade your Node.js runtime environment to version 10 or higher. Tools like `nvm` (Node Version Manager) can help manage multiple Node.js versions efficiently.
If you require `this.spy` or `this.stub` test helpers within your QUnit modules, run `ember install ember-sinon-qunit` alongside `ember-sinon`.
Ensure `import sinon from 'sinon';` is present at the top of your test file and that you are executing the code within an Ember CLI test suite.
Check the `Compatibility` section of the `ember-sinon` README for your specific version, then upgrade your `ember-source` dependency in `package.json` to meet the minimum requirement.
Verify that `ember install ember-sinon` completed without errors. Ensure your `package.json` includes `ember-sinon` and try deleting `node_modules` and `tmp` directories, then run `npm install && ember test`.