Migrating to v2.0

Migrating to v2.0

Sinon v2.0 is the second major release, we have made several breaking changes in this release as a result of modernising the internals of Sinon. This guide is intended to walk you through the changes.

sinon.log and sinon.logError Removed

sinon.log and sinon.logError were used in Sinon v1.x to globally configure FakeServer, FakeXMLHttpRequest and FakeXDomainRequest; these three functions now allow the logger to be configured on a per-use basis. In v1.x you may have written:

sinon.log = function (msg) { // your logging impl };

You would now individually import and configure the utility upon creation:

var sinon = require("sinon");

var myFakeServer = sinon.fakeServer.create({
 logger: function (msg) { // your logging impl }
});

登录查看完整内容