Skip to content

docs: show how to restore stubs after each test - #2828

Open
jakezwang wants to merge 1 commit into
sinonjs:mainfrom
jakezwang:docs/sandbox-per-test
Open

jakezwang wants to merge 1 commit into
sinonjs:mainfrom
jakezwang:docs/sandbox-per-test

Conversation

@jakezwang

Copy link
Copy Markdown
Contributor

Purpose

Add a sandbox tutorial to the how-to guides. The example shows how a teardown hook restores an object method before the next test uses it.

This covers the sandbox tutorial from #2739.

How to verify

  • Run npm ci and npm run build-artifacts at the repository root.

  • In docs, run npm ci, npm run test:docs, and npm run docs:build. All 740 documentation checks passed and the site built.

  • Run the guide's example with node --test sandbox.test.mjs. Both tests passed. Removing the call to sandbox.restore() reproduced the leak: the second test read 100 instead of 120.

  • npm run lint passes.

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