Skip to content

[Bug]: Prettier v3 doesn't work with jest-snapshots #14305

Closed
@TAGraves

Description

@TAGraves

Version

29.6.1

Steps to reproduce

  1. Install prettier@3.0.0, which was just released yesterday
  2. Write a test that would generate an inline snapshot, like:
test('snapshot', () => {
  expect('abc').toMatchInlineSnapshot();
});

Expected behavior

The inline snapshot is updated

Actual behavior

Jest fails with

  ● Test suite failed to run

    TypeError: prettier.resolveConfig.sync is not a function

      at runPrettier (node_modules/jest-snapshot/build/InlineSnapshots.js:308:30)

Additional context

Prettier just released v3, which removed this line that added the sync function to resolveConfig. It looks like eslint-plugin-prettier ran into a similar problem. based on this issue.

Environment

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
    pnpm: 8.5.1 - ~/Library/pnpm/pnpm
  npmPackages:
    jest: ^29.6.0 => 29.6.1

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