-
-
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 are indented at col 0 #11459
Comments
Interesting - my test seems to still be passing, so that's odd 🤔 |
Have you tried adding a new inline snapshot after the upgrade? The bug seems to appear after you add a new inline snapshot expectation in any test case file that has already had some inline snapshots. So, If u didn’t touch your old tests (the tests that work for Jest 26), then they will not break and therefore, the bug is not reproduced. |
That's the conditions my test was meant to test for, since that was the bug the first time around :) |
(sorry to be clear, when I say "my test", I mean the test I added to the |
Your first comment was mind-boggling to me. After reading your next comment, now it makes sense LOL 😂. Perhaps I could try to isolate the issue in a reproducible repository, see if the bug persists. |
Here is a repo:
describe("Index", () => {
it("should work", () => {
expect({ name: "john" }).toMatchInlineSnapshot(`
Object {
"name": "john",
}
`);
});
});
describe("Index", () => {
it("should work", () => {
expect({ name: "john" }).toMatchInlineSnapshot(`
Object {
"name": "john",
}
`);
});
}); |
I strongly suspect this is related to the I found that if I have a formatting "error" (i.e a missing semicolon), then that is corrected and the snapshots are updated with correct indenting, but if there's nothing for prettier to do then we get the lack of indenting behaviour. |
/cc @jeysal any idea? Seems like a regression from the "uglier snapshots" thing, but weird a test didn't catch it |
No, I don't, sorry. Tbf I didn't write most of the actual impl for non-Prettier inline snapshots, was more involved in resolving the massive performance problems that prevented it from landing and then getting it over the line. |
I was able to create a test for this, so #11560 is now good to go - I've updated the description to detail what the problem is and why it wasn't caught by the existing test suite. |
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 indented at col 0, looks like #9477 resurfaced.
Last working version
Worked up to version: 26.6.3
Stopped working in version: 27.0.1
To Reproduce
Steps to reproduce the behavior: #9477
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: