Skip to content

[0.82.0] Unit tests crash when prettier is not installed #54102

@wojtekmaj

Description

@wojtekmaj

Description

Upon upgrading React Native from 0.81.1 to 0.82.0, I began seeing errors during unit testing: "Cannot find module 'prettier' from 'node_modules/react-native/jest/setup.js'".

Steps to reproduce

  1. Install React Native app
  2. Remove prettier and ensure you don't have @react-native/eslint-config installed (which is common if you use Biome or oxlint)
  3. Run Jest unit tests ensuring you have "preset": "react-native", in your Jest config file

React Native Version

0.82.0

Affected Platforms

Other (please specify)

Output of npx @react-native-community/cli info

info Fetching system and libraries information...
System:
  OS: macOS 15.7.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 372.50 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.3.0
    path: /usr/local/bin/node
  Yarn:
    version: 4.10.3
    path: /usr/local/bin/yarn
  npm: Not Found
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.0
      - iOS 26.0
      - macOS 26.0
      - tvOS 26.0
      - visionOS 26.0
      - watchOS 26.0
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 26.0.1/17A400
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.1.1
    wanted: 19.1.1
  react-native:
    installed: 0.82.0
    wanted: 0.82.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

FAIL  src/******.tsx
  ● Test suite failed to run

    Cannot find module 'prettier' from 'node_modules/react-native/jest/setup.js'

      at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (node_modules/react-native/jest/setup.js:1:97)

MANDATORY Reproducer

https://github.com/wojtekmaj/react-native-crash-on-missing-prettier

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions