Skip to content

[Bug]: Jest fails with localstorage error with node 25.2.0 #15888

@shadowspawn

Description

@shadowspawn

Version

30.2.0

Steps to reproduce

Reproduction steps:

  1. Clone https://github.com/shadowspawn/jest-local-storage
  2. using node 25.2.0...
  3. npm install
  4. npx jest

Expected behavior

I expect the tests to run and pass.

Actual behavior

% npx jest
 FAIL  ./index.test.js
  ● Test suite failed to run

    SecurityError: Cannot initialize local storage without a `--localstorage-file` path

      at new NodeEnvironment (node_modules/jest-environment-node/build/index.js:110:52)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.029 s
Ran all test suites.

Additional context

I am using testEnvironment: "node".

There was a change of behaviour in nodejs/node#60351

This failed the node CITGM test for Commander: nodejs/node#60677 (comment)

After reproducing, I opened an issue for Commander: tj/commander.js#2451

And then added a reproduction here!

Environment

System:
    OS: macOS 26.1
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 25.2.0 - /usr/local/bin/node
    npm: 11.6.2 - /usr/local/bin/npm
    bun: 1.2.1 - /opt/homebrew/bin/bun
    Deno: 2.1.7 - /opt/homebrew/bin/deno
  npmPackages:
    jest: ^30.2.0 => 30.2.0

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