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
Hello, I noticed that on Sinon 19 some of my test stoped working.
Case where it happen is related to situations where fakeTimers are used with something that is passed to function and later asserted by Sinon.match.
This is interesting. The code fails when running with the latest Sinon from NPM, but it does not fail with the latest source code in the repo 🤔
✦ ❯ cat my-test.mjs
import * as Sinon from "sinon";
import { test } from "mocha";
test("test date", function () {
const now = new Date("2024-01-01");
const clock = Sinon.useFakeTimers({
now,
toFake: ["Date"],
});
const stub = Sinon.stub();
stub(new Date());
Sinon.assert.calledWith(stub, now);
});
✦ ❯ npx mocha my-test.mjs
1) test date
0 passing (7ms)
1 failing
1) test date:
AssertError: expected stub to be called with arguments
Mon Jan 01 2024 01:00:00 GMT+0100 (GMT+01:00)
at Object.fail (file:///private/tmp/node_modules/sinon/pkg/sinon-esm.js:131:27)
at failAssertion (file:///private/tmp/node_modules/sinon/pkg/sinon-esm.js:274:20)
at assert.<computed> [as calledWith] (file:///private/tmp/node_modules/sinon/pkg/sinon-esm.js:303:17)
at Context.<anonymous> (file:///private/tmp/my-test.mjs:15:16)
at process.processImmediate (node:internal/timers:478:21)
Hello, I noticed that on Sinon 19 some of my test stoped working.
Case where it happen is related to situations where fakeTimers are used with something that is passed to function and later asserted by Sinon.match.
Here is minimal code to reproduce it:
This code works fine on v18 but it fails on v19.
The text was updated successfully, but these errors were encountered: