Skip to content

[JEST] Error prettier.resolveConfig.sync is not a function when run unit test with Jest #13739

@kientrant1

Description

@kientrant1

With current react-scripts, I got below issue when using with Prettier v3. Seems like it's resolved in latest Jest version. However, react-scripts just supports Jest v27.

This issue happens if using snapshot function (i.e, toMatchInlineSnapshot) in my test.

`TypeError: prettier.resolveConfig.sync is not a function

  at runPrettier (node_modules/jest-snapshot/build/InlineSnapshots.js:390:30)
  at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
  at runJest (node_modules/@jest/core/build/runJest.js:404:19)`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions