-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: Error if prettier@3
is used for inline snapshots
#14367
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
docs/Configuration.md
Outdated
@@ -1144,6 +1144,37 @@ Default: `'prettier'` | |||
|
|||
Sets the path to the [`prettier`](https://prettier.io/) node module used to update inline snapshots. | |||
|
|||
Note that Prettier version 3 is not supported. You can either pass `prettierPath: null` in your config to disable using prettier if you don't need it, or use v2 of Prettier solely for Jest. |
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've forgotten to roll 29.6 docs - will do so after landing this
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.
What about wrapping this block in some :::info
admonition?
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.
Or perhaps like this:
<details>
<summary>Prettier version 3 is not supported!</summary>
Etc...
</details>
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.
ooh, details
look great! didn't know docusaurus formatted it
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.
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.
Looks good! details
is a rarely useful feature, but for my eye it’s just perfect in this case.
Sadly, Prettier v3 breaks inline snapshots: FAIL packages/legacy/src/parser/__tests__/parse-test.ts ● Test suite failed to run Jest: Inline Snapshots are not supported when using Prettier 3.0.0 or above. See https://jestjs.io/docs/configuration/#prettierpath-string for alternatives. at saveInlineSnapshots (node_modules/jest-snapshot/build/InlineSnapshots.js:101:15) So, as noted in: - jestjs/jest#14367 set `prettierPath` in the Jest config, install v2 just for use by Jest, update the snapshots, which now have an, um, prettier format, like this: - "selections": Array [ - Object { + "selections": [ + { and then re-run Prettier manually with `yarn format` to make sure that everything remains stable.
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
As mentioned in #14311 (comment), we're currently blocked on supporting v3 properly. I think it's better to throw an explicit error for users pointing to docs with a workaround.
Test plan
E2E test added