Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM and node: protocol in imports #11339

Closed
ai opened this issue Apr 24, 2021 · 3 comments 路 Fixed by #11331
Closed

ESM and node: protocol in imports #11339

ai opened this issue Apr 24, 2021 · 3 comments 路 Fixed by #11331

Comments

@ai
Copy link
Contributor

ai commented Apr 24, 2021

馃悰 Bug Report

Jest can鈥檛 use node: protocol in ESM imports:

Cannot find module 'node:path' from 'protocol.test.js'

There is a discussion of using this protocol in Node.js docs.

To Reproduce

Steps to reproduce the behavior:

mkdir test && cd test
echo '{ "type": "module" }' > package.json
yarn add jest@^27.0.0-next.8
echo "import { join } from 'path'; it('tests', () => { expect(typeof join).toEqual('function') })" > no-protocol.test.js
echo "import { join } from 'node:path'; it('tests', () => { expect(typeof join).toEqual('function') })" > protocol.test.js
node --experimental-vm-modules node_modules/.bin/jest

Expected behavior

Tests should be passed without Cannot find module 'node:path' error.

envinfo

  System:
    OS: Linux 5.11 Fedora 33 (Workstation Edition) 33 (Workstation Edition)
    CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
  Binaries:
    Node: 16.0.0 - ~/.asdf/installs/nodejs/16.0.0/bin/node
    Yarn: 1.22.10 - ~/.asdf/shims/yarn
    npm: 7.10.0 - ~/.asdf/installs/nodejs/16.0.0/bin/npm
  npmPackages:
    jest: ^27.0.0-next.8 => 27.0.0-next.8
@ahnpnl
Copy link
Contributor

ahnpnl commented Apr 24, 2021

Seem like it鈥檚 in #11331

@ai
Copy link
Contributor Author

ai commented Apr 24, 2021

@ahnpnl yeap, thanks. Hope to see it in the @next release soon.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants