Skip to content

fix: Reset local state of assertions when using hasAssertions#4498

Merged
cpojer merged 1 commit intojestjs:masterfrom
thymikee:fix/has-assertions
Sep 18, 2017
Merged

fix: Reset local state of assertions when using hasAssertions#4498
cpojer merged 1 commit intojestjs:masterfrom
thymikee:fix/has-assertions

Conversation

@thymikee
Copy link
Contributor

Summary

.hasAssertions leaked to every test case following the one it was declared in.
Also decided to extract setState call to a function named resetAssertionsState so it's easier to understand what it does.
Fixes #4496.

Test plan

Empty test without assertions. Fails on current master.

@cpojer cpojer merged commit 03fa502 into jestjs:master Sep 18, 2017
@cpojer
Copy link
Member

cpojer commented Sep 18, 2017

Nice!

@mattphillips
Copy link
Contributor

From the looks of it this fixes #3595 too and will also fix this issue in babel-jest-assertions

I just debugged the issue all the way to find the state not being reset and was about to open a PR and then found this one 😆 nice one @thymikee! At least I have a bit of a better understanding of how Jest works now 😄

@cpojer Do you know when this will be released?

@cpojer
Copy link
Member

cpojer commented Sep 25, 2017

This week.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expect.hasAssertions() triggered in different test

4 participants