Skip to content

[Bug?]: node:test not recognised as built-in module by @yarnpkg/doctor #6343

Closed
@bradleyayers

Description

@bradleyayers

Self-service

  • I'd be willing to implement a fix

Describe the bug

I'm importing the node:test module, but doctor gives me an error saying it's an undeclared dependency.

To reproduce

  1. Create a file with import "node:test".
  2. Run doctor

Environment

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Max
Binaries:
  Node: 21.6.1 - /private/var/folders/fs/c9jy5p9s6cvg_2hv2x2gn5pc0000gn/T/xfs-446a8e07/node
  Yarn: 4.2.2 - /private/var/folders/fs/c9jy5p9s6cvg_2hv2x2gn5pc0000gn/T/xfs-446a8e07/yarn
  npm: 10.2.4 - ~/.proto/shims/npm

Additional context

It looks like because this module is only importable as node:test and not as just test, this code

...(Module.builtinModules || []).map(mod => `node:${mod}`),
does not cater for it. node:test also isn't listed in require("module").builtinModules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions