Skip to content

[Bug]: Jest crashes on Node.js v23 when using jest.config.js contains TLA #15363

@fisker

Description

@fisker

Version

30.0.0-alpha.6

Steps to reproduce

The jest.config.js file in Prettier repo imports a module that contains TLA (comes from temp-dir), when using Node.js v23 Jest crashes. prettier/prettier#16761

Expected behavior

Run tests without error.

Actual behavior

Error: require() cannot be used on an ESM graph with top-level await. Use import() instead. To see where the top-level await comes from, use --experimental-print-required-tla.

Additional context

I tried to comment out our install-prettier.js

Jest runs without error.

If I add

await Promise.resolve()

The error comes back.

Environment

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 23.1.0 - ~\AppData\Local\fnm_multishells\1144_1730082443572\node.EXE
    Yarn: 4.5.0 - D:\npm\yarn.CMD
    npm: 10.9.0 - ~\AppData\Local\fnm_multishells\1144_1730082443572\npm.CMD
    pnpm: 9.3.0 - D:\npm\pnpm.CMD
  npmPackages:
    jest: 30.0.0-alpha.6 => 30.0.0-alpha.6

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