Make sandboxes each use their own assert object #2302
Merged
+209
−181
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
Fix issue #2298 by having assertion objects be created by each sandbox instead of using the global one
Intuitively you would think that sandboxes use isolated assertion objects. But this was not the case. If you overrode the
failException
orpass
/fail
functions, they would apply to all sandboxes and all assertions. This particularly was an issue with concurrent testing, such as with AVA.We no longer create and export a single
assert
object, instead there is acreateAssertionObject
function that is used inside the sandboxes' constructor.How to verify - mandatory
npm install
npm test
Checklist for author
npm run lint
passesPS: on github the diff shows very poorly. In actuality only ~3 lines changed and a test case was added, but a buch of lines were indented one step.