Skip to content

ReferenceError: WritableStream is not defined when importing nodeToFsa function #1104

@edsinclair

Description

@edsinclair

I have the import statement:

import { nodeToFsa } from "memfs/lib/node-to-fsa";

in a spec file. When attempting to run the spec using jest (29 and 30) I'm getting the following error:

ReferenceError: WritableStream is not defined

      at Object.<anonymous> (/.yarn/berry/cache/memfs-npm-4.17.2...memfs/src/node-to-fsa/NodeFileSystemWritableFileStream.ts:61:55)
      at Object.<anonymous> (/.yarn/berry/cache/memfs-npm-4.17.2...memfs/src/node-to-fsa/NodeFileSystemFileHandle.ts:4:1)
      at Object.<anonymous> (/.yarn/berry/cache/memfs-npm-4.17.2...memfs/src/node-to-fsa/NodeFileSystemDirectoryHandle.ts:11:1)
      at Object.<anonymous> (/.yarn/berry/cache/memfs-npm-4.17.2...memfs/src/node-to-fsa/index.ts:1:1)

Other exports don't seem to have this dependency. Any suggestions for resolving this would be appreciated.

Versions:

node -v
v24.1.0

"jest@npm:^30":
  resolution: "jest@npm:30.0.0"
    "@jest/core": "npm:30.0.0"
    "@jest/types": "npm:30.0.0"

"memfs@npm:^4.17.2":
  resolution: "memfs@npm:4.17.2"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions