From cc669dd11c24a7556ffbc1430122d5059418c590 Mon Sep 17 00:00:00 2001 From: Ryan Ling Date: Wed, 19 Jul 2023 12:34:50 +1000 Subject: [PATCH 1/2] RFC: Disable Prettier snapshot formatting The other option would be to revert to Prettier 2. --- .changeset/nine-keys-accept.md | 14 ++++++++++++++ jest-preset.js | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 .changeset/nine-keys-accept.md diff --git a/.changeset/nine-keys-accept.md b/.changeset/nine-keys-accept.md new file mode 100644 index 000000000..94c586e46 --- /dev/null +++ b/.changeset/nine-keys-accept.md @@ -0,0 +1,14 @@ +--- +'skuba': patch +--- + +test: Disable Prettier snapshot formatting + +Jest is not yet compatible with Prettier 3. Before this change, updating snapshots would fail with the following error: + +```typescript +TypeError: prettier.resolveConfig.sync is not a function + at runPrettier (node_modules/jest-snapshot/build/InlineSnapshots.js:308:30) +``` + +You may have to run `skuba format` manually after updating snapshots until [jestjs/jest#14305](https://github.com/jestjs/jest/issues/14305) is resolved. diff --git a/jest-preset.js b/jest-preset.js index 27baa3b87..d93dddbea 100644 --- a/jest-preset.js +++ b/jest-preset.js @@ -27,6 +27,8 @@ module.exports = { '/node_modules.*/', '/(coverage|dist|lib|tmp).*/', ], + // jestjs/jest#14305 + prettierPath: null, watchPlugins: [ require.resolve('jest-watch-typeahead/filename'), require.resolve('jest-watch-typeahead/testname'), From 109ba332b3121d30c267af5e8fef0296ac76b35f Mon Sep 17 00:00:00 2001 From: Ryan Ling Date: Wed, 19 Jul 2023 12:44:29 +1000 Subject: [PATCH 2/2] Update nine-keys-accept.md --- .changeset/nine-keys-accept.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.changeset/nine-keys-accept.md b/.changeset/nine-keys-accept.md index 94c586e46..8f339a81c 100644 --- a/.changeset/nine-keys-accept.md +++ b/.changeset/nine-keys-accept.md @@ -4,11 +4,19 @@ test: Disable Prettier snapshot formatting -Jest is not yet compatible with Prettier 3. Before this change, updating snapshots would fail with the following error: +Jest is not yet compatible with Prettier 3, causing snapshot updates to fail with the following error: ```typescript TypeError: prettier.resolveConfig.sync is not a function at runPrettier (node_modules/jest-snapshot/build/InlineSnapshots.js:308:30) ``` +We have disabled Prettier snapshot formatting in our Jest preset as a temporary workaround. If you do not use the preset, you can manually modify your `jest.config.ts` like so: + +```diff +export default { ++ prettierPath: null, +} +``` + You may have to run `skuba format` manually after updating snapshots until [jestjs/jest#14305](https://github.com/jestjs/jest/issues/14305) is resolved.