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
We noticed yesterday that between invocation of jasmine.Clock.useMock(), Jasmine does not reset the list of scheduledFunctions. This was the cause of some test pollution for us, where things scheduled in previous tests were still running in later tests.
To see the bug, in useMock(), output the list of scheduledFunctions. You'll see that functions scheduled in previous tests are still pending execution.
We worked around this by adding to our SpecHelper.js:
afterEach(function () {
// Jasmine's mock clock does not remove scheduled functions between specs,
// which allows for test pollution.
jasmine.Clock.defaultFakeTimer.reset();
});
...although the real fix is probably to ensure FakeTimer.reset gets called at each useMock.
Thanks!
Rob
The text was updated successfully, but these errors were encountered:
Hi guys,
We noticed yesterday that between invocation of jasmine.Clock.useMock(), Jasmine does not reset the list of scheduledFunctions. This was the cause of some test pollution for us, where things scheduled in previous tests were still running in later tests.
To see the bug, in useMock(), output the list of scheduledFunctions. You'll see that functions scheduled in previous tests are still pending execution.
We worked around this by adding to our SpecHelper.js:
afterEach(function () {
// Jasmine's mock clock does not remove scheduled functions between specs,
// which allows for test pollution.
jasmine.Clock.defaultFakeTimer.reset();
});
...although the real fix is probably to ensure FakeTimer.reset gets called at each useMock.
Thanks!
Rob
The text was updated successfully, but these errors were encountered: