-
Notifications
You must be signed in to change notification settings - Fork 21
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 sinon match with referee #249
Conversation
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## main #249 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 81 81
Lines 666 666
=========================================
Hits 666 666
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
The test seems a bit fragile when it depends on someone needing to keep two libraries in sync. Could we possibly change this for something that can handle different versions interacting? Say, check for a Symbol or something. |
That wouldn't help. If there are two versions of the library in the tree, the symbol would exist twice as well. We would need a global ... |
Could employ |
That's a good idea. I like it! |
@fatso83 Can I merge and release a patch of this? The current v11 of |
sure, I am not a blocker :) |
Purpose (TL;DR) - mandatory
In sinonjs/sinon#2498
@sinonjs/samsam
was upgraded to v8 and this was released with sinon v15.0.2. This beaks a use case whensinon.match
is used with referee assertions.This PR adds a failing test, demonstrating the issue and upgrades samsam to v8 to fix it.
Background (Problem in detail) - optional
The
isMatcher
helper in samsam checks whether the prototype of the given object is the matcher prototype (https://github.com/sinonjs/samsam/blob/main/lib/create-matcher/is-matcher.js). When there are two different versions of samsam in the dependency tree, there are two instances of that prototype. Therefore matcher detection fails if the matcher was created with the one version and the check is done with the other version of samsam.Solution - optional
There should always be exactly one version of samsam in the dependency tree.
How to verify - mandatory
npm install
npm test
Checklist for author
npm run lint
passes