-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
fix(expect, jest-snapshot): Pass test.failing
tests when containing failing snapshot matchers
#14313
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
614532b
to
083532f
Compare
test.failing
tests when containing failing snapshot matchers
I see you are still working. Just few quick notes:
Rather complicated. Hope this saves your time. |
@mrazauskas Thanks Tom. What do you think of using an optional dynamic import in |
TypeScript does not allow to have circular references between packages. So importing That’s just technical peculiarity, but in general I think this problem should be sorted out inside the runner. It does not feel like matchers should know something about the runner or its state. |
That makes sense, thank you. Fortunately this could be a blessing in disguise because of some limitations with maintaining the snapshots that fail, while making them throw errors instead of suppressing them. Back to the drawing board! |
I've adapted my PR (local) to not use any circus imports by adding adding and setting a property in This ends up solving the root cause, allows execution to stop after the first failure, and simplifies post-processing in |
083532f
to
90bb2e2
Compare
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.
To be honest, I don’t know the logic snapshot matchers logic in detail. Perhaps others will bring in more feedback.
What I know: @jest/expect
was introduced (see #12404) to separate expect
and snapshot matchers. So it feels strange to see expect
being involved in something what is used only by snapshot matchers.
Perhaps it is possible to involve SnapshotState
somehow?
7ea49cf
to
c718869
Compare
I moved the property to |
…g tests when containing failing snapshot matchers
c718869
to
55cca64
Compare
Hi @SimenB, could you please review this PR for approval? Also, the failed tests are all Jasmine runs which exit with code 1 because when I skip the tests in the file, it registers obsolete snapshots. Is there a way to skip the test file completely when Jasmine is the runner? |
@SimenB Any updates? |
Looks like jasmine test is failing on CI. Might need to skip them |
What would be a good way to do that? One that comes to mind is to edit {
//..
testPathIgnorePatterns: [
'/__arbitraries__/',
'/__benchmarks__/',
'/__fixtures__/',
...(process.env.JEST_JASMINE ? [
'e2e/.../'
] : [])
],
//..
} |
@SimenB We're all green ✅ |
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.
thank you for a fantastic PR and your patience!
… failing snapshot matchers (jestjs#14313)
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. |
Summary
Fix an issue where failed snapshot matchers didn't trigger tests called with
test.failing
to pass.With this change, Snapshot matchers in
test.failing
will:Test plan
E2e tests were added to ensure the correct test outcome and to ensure that snapshots didn't update.