Skip to content

Fix sandbox fake factory arguments and call order - #2774

Open
jakezwang wants to merge 1 commit into
sinonjs:mainfrom
jakezwang:fix-fake-factory-context
Open

jakezwang wants to merge 1 commit into
sinonjs:mainfrom
jakezwang:fix-fake-factory-context

Conversation

@jakezwang

Copy link
Copy Markdown

Purpose (TL;DR) - mandatory

Keep sandbox call-order tracking separate from fake factory arguments. fake.yields() and fake.yieldsAsync() currently pass an extra internal object to callbacks, while fake.returns() and fake.resolves() without a value return that object instead of undefined.

Attach the existing non-enumerable sinonContext to the created fake. This also keeps callback fakes in the sandbox's call order.

How to verify - mandatory

  1. Check out this branch.
  2. npm ci
  3. npm test and npm run test-contract (Chrome configured).
  4. npm run lint and npm run prettier:check.

The eight added regressions fail before the fix. Node 22, 24 and 26 each pass 1,564 tests; Chrome passes 1,557 tests and the Web Worker test passes. Existing pending tests remain pending.

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

This branch has not been deployed

No deployments
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.

1 participant