-
Notifications
You must be signed in to change notification settings - Fork 470
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
test: Fix inline snapshot mismatch on certain machines #1040
Conversation
f080a90
to
8debfaf
Compare
src/__tests__/pretty-dom.js
Outdated
@@ -45,16 +45,34 @@ test('prettyDOM defaults to document.body', () => { | |||
</body>" | |||
` | |||
renderIntoDocument('<div>Hello World!</div>') | |||
expect(prettyDOM()).toMatchInlineSnapshot(defaultInlineSnapshot) | |||
expect(prettyDOM(null)).toMatchInlineSnapshot(defaultInlineSnapshot) | |||
expect(prettyDOM()).toMatchInlineSnapshot( |
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.
Hmmm... not sure what happened here, I need to investigate this change.
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.
Okay, fixed, it was a problem with automatically updating inline snapshots.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3723cbe:
|
Codecov Report
@@ Coverage Diff @@
## main #1040 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 920 920
Branches 284 284
=========================================
Hits 920 920
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
That's awesome! Will check tomorrow if this fixes it for me locally. And then we probably want to apply this fix in all testing-library repos |
Let me know how it goes! Regarding other testing-library repos, I could not find any other repository making use of ansi snapshot tests, I found this PR removing some snapshot tests on jest-dom repository, maybe this was experiencing a similar issue? |
If you need someone on a Windows environment to test this, feel free to ping me. |
@timdeschryver sorry if the comment wasn't for me, but if I may, I think running tests on Windows could do no harm and would, in fact, add more confidence to these changes. So please, if you could test on Windows, I think that would be great. |
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.
Works on my machine 👍
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.
Awesome!
🎉 This PR is included in version 8.7.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
Two snapshot tests were failing locally while passing on CI, this change fixes it so that tests are green on CI as well as locally.
The replaced library was appending extra double quotes at the begging and end of the string.
https://github.com/joaogranado/jest-serializer-ansi/blob/c8c5e8cbc0f804f9fe195dfd27625ea0b3d2a062/index.js#L13-L16
How:
Replacing jest-serializer-ansi library with jest-snapshot-serializer-ansi.
Checklist: