我正在尝试使用sinon.js测试骨干应用程序.但不幸的是我因为错误而无法使用间谍方法:
TypeError: 'undefined' is not a function (evaluating 'sinon.spy()')
Run Code Online (Sandbox Code Playgroud)
以下是重现错误的步骤:
cd test && bower install sinon
<script src="bower_components/sinon/lib/sinon.js"></script>
在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 Code Online (Sandbox Code Playgroud)用grunt运行测试: grunt test
测试将失败并显示错误.
谁能帮忙找出问题所在?