I'm trying to use sinon.js in testing of a backbone application. But unfortunately I cannot use spy method due to error:
TypeError: 'undefined' is not a function (evaluating 'sinon.spy()')
Here is the steps to reproduce the error:
- Create an empty project with backbone yeoman generator
- Install sinon:
cd test && bower install sinon - Include in test/index.html
<script src="bower_components/sinon/lib/sinon.js"></script> Create spy in test/spec/test.js:
describe('Give it some context', function () { describe('maybe a bit more context here', function () { it('should run here few assertions', function () { var spy = sinon.spy(); spy.should.be.ok; }); }); });Run the test with grunt:
grunt testThe test will fail with a described error.
Could anyone help to find out what is wrong?