我收到错误:
- TypeError:试图包装已经包装好的ajax
错误:原始 chai.should() 的堆栈跟踪;
describe("Test API", function() { it('executes a GET request for ISPs', function() { var mySpy = sinon.spy(jQuery, "ajax"); sinon.stub(jQuery, 'ajax'); mySpy.should.have.been.calledWithMatch({ url: 'http://data-api.measurementlab.net/locations/nausdcwashington/clients' }); }); after(function() { jQuery.ajax.restore(); }); });
我遇到了类似的帖子并添加了该after
块。仍然出现同样的错误:Sinon.js- Trying to spy on console.log 但它已经被打包