You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our tests suddenly started failing after upgrading to the newest version of sinon. Stubbing objects that have a constructor while using the sandbox does not work properly -- sandbox.restore() does not restore the constructor. This issue does not occur in 1.16.
An example which replicates this issue:
describe.only('sandbox-test', function(){
function MyClass(){}
it('should not throw an error', function(){
var myObject = new MyClass();
var sandbox = sinon.sandbox.create();
sandbox.stub(myObject);
sandbox.restore();
sandbox.stub(myObject);
});
});
The error that occurs:
sandbox-test
1) should not throw an error
0 passing (86ms)
1 failing
1) sandbox-test should not throw an error:
TypeError: Attempted to wrap constructor which is already wrapped
at checkWrappedMethod (node_modules/sinon/lib/sinon/util/core.js:81:29)
at Object.wrapMethod (node_modules/sinon/lib/sinon/util/core.js:121:21)
at stub (node_modules/sinon/lib/sinon/stub.js:66:26)
at node_modules/sinon/lib/sinon/stub.js:59:25
at node_modules/sinon/lib/sinon/walk.js:34:26
at Array.forEach (native)
at Object.walk (node_modules/sinon/lib/sinon/walk.js:33:45)
at Object.stub (node_modules/sinon/lib/sinon/stub.js:52:23)
at Object.stub (node_modules/sinon/lib/sinon/collection.js:106:49)
at Context.<anonymous> (test/unit/sandbox-test.js:16:13)
The text was updated successfully, but these errors were encountered:
Our tests suddenly started failing after upgrading to the newest version of sinon. Stubbing objects that have a constructor while using the sandbox does not work properly -- sandbox.restore() does not restore the constructor. This issue does not occur in 1.16.
An example which replicates this issue:
The error that occurs:
The text was updated successfully, but these errors were encountered: