docs: explain dependency injection with Sinon - #2756
Draft
Frostand wants to merge 1 commit into
Draft
Conversation
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.
Purpose (TL;DR) - mandatory
Fixes #1458 by adding an executable guide that demonstrates plain dependency injection with a Sinon stub, without module interception.
Background (Problem in detail) - optional
The existing how-to material covers link seams, while #1458 asks for a small no-framework dependency-injection example. The guide shows a factory that accepts its API dependency, a production composition root, and a test that injects and asserts a Sinon stub.
Solution - optional
How to verify - mandatory
npm installat the repository root and indocs/.npm run build-artifactsnpm run test-node— 1,556 passing; 12 pendingnpm run lintnpm run prettier:checknpm run test:docs— 733 passingnpm run docs:buildKnown baseline limitations: docs-wide lint/format checks report existing issues in untouched tests and generated files, and link checking requires the external
lycheebinary. The new guide/test and edited generator pass targeted lint/format checks; no dependency or lockfile changed.Checklist for author
npm run lintpassesTooling disclosure: this change was prepared with OpenAI Codex and validated with the commands above.