fix: share call order with stub instances - #2764
Closed
wangxpych wants to merge 1 commit into
Closed
Conversation
Thread each sandbox's callId context through createStubInstance so its generated methods can be ordered against spies and stubs from the same sandbox. Preserve the root API wrapper while routing it through its backing sandbox. Fixes #2760
Author
|
Withdrawing this contribution after re-evaluating the repository's recent human review and merge activity. No action is needed from maintainers. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2760.
Problem
The per-sandbox
callIdcontext added for parallel-test isolation is passed throughspy(),stub(), andfake(), butcreateStubInstance()still creates its method stubs with the module-level default context. Comparisons against other fakes from the same sandbox can therefore report the wrong call order.Changes
createStubInstance()when its methods are stubbed.sinon.createStubInstance()wrapper through its backing root sandbox so it uses the same context as root spies and stubs.Verification
npm test— Node: 1,558 passing / 12 pending; headless browser: 1,551 passing / 13 pending; WebWorker: 1 passingnpm run lintnpm run prettier:checknpm run test-contractnpm run check-dependencies