Skip to content

Commit

Permalink
RFC: Disable Prettier snapshot formatting (#1220)
Browse files Browse the repository at this point in the history
The other option would be to revert to Prettier 2.
  • Loading branch information
72636c authored Jul 19, 2023
1 parent 39bfcd4 commit 2e7a545
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .changeset/nine-keys-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'skuba': patch
---

test: Disable Prettier snapshot formatting

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.
2 changes: 2 additions & 0 deletions jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module.exports = {
'/node_modules.*/',
'<rootDir>/(coverage|dist|lib|tmp).*/',
],
// jestjs/jest#14305
prettierPath: null,
watchPlugins: [
require.resolve('jest-watch-typeahead/filename'),
require.resolve('jest-watch-typeahead/testname'),
Expand Down

0 comments on commit 2e7a545

Please sign in to comment.