Docs: Fix incorrect sandbox configuration documentation. #1443
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)
The documentation for
sinon.sandbox
is incorrect and this PR fixes it. The bug was originally identified in #617.Background (Problem in detail)
@divmain identified that the
sinon.sandbox
documentation is wrong in #617 and in a fiddle http://jsfiddle.net/8k0zv6tp/Here's a concise example:
The documentation says that calling:
essentially means:
This is wrong. In the shell we have:
What really happens is equivalent to:
The upstream #617 issue was closed with #617 (comment) comment of:
As part of the public API, some of our biggest clients use
sandbox
exclusively for large test suites for better fake management and cleanup, we have a vested interest in making sure the documentation and behavior of sandbox is correct.So, after the issue was closed I asked "is this a bug? or a documentation bug?" and I haven't received a response. So, I took a hint from the closing comment and making the simplifying assumption it's a documentation bug and here's the requested PR!
Enjoy!
How to verify
The documentation behavior being wrong can be seen with: