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.each
name serialization has changed to be less useful, impacting snapshots.
#3955
Comments
prior to Also since they're back to using Jest diff output, I know that Jest v29 changed their default snapshot format (see their Jest 29 blogpost) and it looks like it shows the old format on your side. I think there is a flag you change in your settings to show the new snapshot format, I would have to search for it... yes here is the link: hope that is helpful :) |
@ghiscoding actually, this PR talks about test name formating. It is different now because instead of using node's built-in |
I was going back some commits and maybe this commit 4f6c134 changed something? (which might not be related node-util vs loupe change) It looks like currently loupe's In such case, the "untruncated" loupe output is checked against default I made a repro to show the effect of
https://stackblitz.com/edit/vitest-dev-vitest-5cqlhe?file=test%2Frepro.test.ts ✓ test/repro.test.ts (9)
✓ '012345678901234567890123456789' (length = 30)
✓ '0123456789012345678901234567890123456789' (length = 40)
✓ '01234567890123456789012345678901234567890123456789' (length = 50)
✓ [ 'one', 'two', 'three' ]
✓ [ 'one', 'two', 'three', 'four' ]
✓ [ Array(5) ]
✓ { one: 1, two: 2, three: 3 }
✓ { one: 1, two: 2, three: 3, four: 4 }
✓ { Object (one, two, ...) }
https://stackblitz.com/edit/vitest-dev-vitest-mpfgjn?file=test%2Frepro.test.ts ✓ test/repro.test.ts (7)
✓ '012345678901234567890123456789' (length = 30)
✓ '0123456789012345678901234567890123456…' (length = 40)
✓ '0123456789012345678901234567890123456…' (length = 50)
✓ [ 'one', 'two', 'three' ]
✓ [ 'one', 'two', 'three', 'four' ]
✓ [ 'one', 'two', 'three', 'four', …(1) ]
✓ [ 'one', 'two', 'three', 'four', …(2) ]
✓ { one: 1, two: 2, three: 3 }
✓ { one: 1, two: 2, three: 3, four: 4 }
✓ { one: 1, two: 2, three: 3, …(2) } |
Thank you! I would never have found that setting. |
Describe the bug
When migrating from
0.31.4
to0.34.1
, it appears that the serializer used to format test names has changed, impacting snapshots and test result readability.Example snapshot change:
Array(4)
is not very useful. This leads to a lot of duplicate test names. It also makes figuring out which test failed painful. I understand that due to test order, this should not be an issue with matching up snapshots, but it has lead to a LOT of churn with respect to.snap
files.I hope this gets fixed, because identifying a failed test out of hundreds can be painful if they all result in the same displayed name and snapshot identifier.
Reproduction
Diff of snapshot going from
0.31.4
to0.34.1
:System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: