-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
jest-snapshot: Distinguish empty string from internal snapshot not written #8898
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8898 +/- ##
==========================================
+ Coverage 64.23% 64.24% +0.01%
==========================================
Files 275 275
Lines 11658 11656 -2
Branches 2845 2844 -1
==========================================
Hits 7488 7488
+ Misses 3546 3544 -2
Partials 624 624
Continue to review full report at Codecov.
|
SimenB
left a comment
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.
I like it 🙂
|
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
Breaking change: Add boolean
isInlineproperty toSnapshotMatchOptionssoinlineSnapshot: undefinedmeans internal snapshot not written instead of external snapshotinlineSnapshot: ''means empty string instead of internal snapshot not writtenWhile trouble-shooting #8880 empty string in external snapshot, I found that internal snapshots had similar problem with different effect:
'--ci=false'when inline snapshot is empty string and received value is non-empty string, then instead of ordinary failure, test passes and replaces expected with received'--ci=true'when inline snapshot was not written, test has ordinary failure with empty string as expected valueEdge case 1 requires custom serializer which writes empty string not enclosed in quote marks
Effect of change on dependent packages without TypeScript that do not upgrade a
matchcall:isInlinemeans not inlineFor what it’s worth, while reviewing GitHub repos for a subset of dependents on
jest-snapshotI did found few calls tomatchmethod ofSnapshotStateand no calls to match inline snapshotTest plan
Added 2 new e2e tests
Especially because of
prettierupdate to inline snapshot tests, I changed the enclosing punctuation for literal strings from double quote to single quote