-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sandboxes each use their own assert object #2302
Conversation
@@ -37,6 +37,8 @@ function Sandbox() { | |||
var fakeRestorers = []; | |||
var promiseLib; | |||
|
|||
sandbox.assert = sinonAssert.createAssertObject(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good.
Thanks for the changes: a very welcome improvement, Kim! 💯 Just a tip: if you think the diff is messier than what is actually happening, you can suppress all whitespace changes by passing a query parameter: |
Ok, so no |
Very nice PR, thank you 🍰 |
This has been published with |
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.