Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: recreate mock on reset() #76

Merged
merged 3 commits into from
Feb 10, 2022
Merged

fix!: recreate mock on reset() #76

merged 3 commits into from
Feb 10, 2022

Conversation

m-radzikowski
Copy link
Owner

The #67 turned out to be a consequence of a well-known Sinon.JS bug sinonjs/sinon#1572

The Sinon bug consequences are limited since we always use sinon.match expressions, but in some scenarios, the reset() could not clean the stub properly and have the behavior leak between the tests. To solve this, now the Sinon stub is recreated on calling reset().

Because of the Sinon.JS bug, the resetBehavior() method, calling Sinon.JS stub.resetBehavior(), cannot be relied upon and is removed, since there is no easy fix for it.

Fixes #67

This prevents mock behaviors breaking subsequent behaviors
between the reset() calls due to Sinon.JS bug #1572.
The resetBehavior() method, calling Sinon.JS stub.resetBehavior(),
cannot be relied upon because of Sinon.JS bug #1572.
@m-radzikowski m-radzikowski merged commit 9e1a873 into main Feb 10, 2022
@m-radzikowski m-radzikowski deleted the issue67 branch February 10, 2022 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rest() and resetBehavior() stops onAnyCommand() working (DynamoDB)
1 participant