-
-
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
Inline snapshots drift to the right #8424
Comments
Thanks for the report. I'll take a look at it very soon. Do you know if it happens outside of watch mode? |
Yep, just tested and confirmed same thing happens with |
I recommend removing the snapshot and regenerating it - that should stop the diff. Still a bug, of course, but should fix your issue 🙂 |
@SimenB that's what I ended up doing. |
Is there a way to tell yarn generate everything from scratch? |
FYI I see this happen with Jest@24.5 as well. Jest@24.0 also has the same bug. I'm not sure that it's a recent regression. I also wonder if it could be somewhat linked to Prettier and its integration into Visual Studio Code on save (could there be a race condition?). |
Not related to VSCode, I don't use it but still see this happen frequently using latest Jest. Didn't have time to investigate yet though :/ |
It may be regression introduced by this: #8198 |
Yeah definitely |
Fixes jestjs#8424 by avoiding indenting inline snapshot if second line of inline snapshot already has been indented.
Fixes jestjs#8424 by avoiding indenting inline snapshot if second line of inline snapshot already has been indented.
Fixes jestjs#8424 by avoiding indenting inline snapshot if second line of inline snapshot already has been indented.
Fixes jestjs#8424 by avoiding indenting inline snapshot if second line of inline snapshot already has been indented.
@petternordhold, |
Any chance to see the fix released before jest 25? |
@Bnaya yes, we haven't landed breaking changes yet, there will we another minor before 25 |
(Seems this fix was released in jest 24.0.18?) |
24.9.0 has it 🙂 |
Summary: This diff regenerates all Jest inline snapshots (`expect().toMatchInlineSnapshot()`) now that we use Jest 24.9.0 which fixes a longstanding [formatting instability bug](jestjs/jest#8424). This is strictly a formatting change. Changelog: [Internal] Reviewed By: cpojer Differential Revision: D19684238 fbshipit-source-id: 77c1e5fe9d2dfef85dffdcc00056fb439d7d7f84
Summary: This diff regenerates all Jest inline snapshots (`expect().toMatchInlineSnapshot()`) now that we use Jest 24.9.0 which fixes a longstanding [formatting instability bug](jestjs/jest#8424). This is strictly a formatting change. Changelog: [Internal] Reviewed By: cpojer Differential Revision: D19684238 fbshipit-source-id: 77c1e5fe9d2dfef85dffdcc00056fb439d7d7f84
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
💥 Regression Report
Inline snapshots are re-indented whenever another inline snapshot in the same file is saved/updated.
Last working version
Worked up to version: 24.5
Stopped working in version: 24.6
To Reproduce
Steps to reproduce the behavior:
Given this test file and we're running in watch mode:
Upon save, both snapshots are written:
Now I update the first test (
expect(10000).toMatchInlineSnapshot()
) and save. The snapshots get rewritten:Now I add another test (
expect(3).toMatchInlineSnapshot()
) and save:Notice how the snapshot for test
2
slowly drifts to the right. This can get super annoying after many test-update-save cycles.Expected behavior
Inline snapshots should stay put.
Link to repl or repo (highly encouraged)
Repl.it only has Jest 22.1.2. I didn't find a way to upgrade it.
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: