Description
🐛 Bug Report
When two modules dynamically imported in parallel depend on the same file*, Jest crashes with a request for ... is not yet fulfilled
error. The error is thrown by https://github.com/nodejs/node/blob/e46c680bf2b211bbd52cf959ca17ee98c7f657f5/src/module_wrap.cc#L535, so it's possible that this is a Node.js bug and not a Jest bug.
In my repository example below, I import two files in parallel (if I import them serially the test passes):
https://github.com/nicolo-ribaudo/babel/blob/31dac517b7ce0d504bda794075f0a88029cedd58/packages/babel-plugin-proposal-private-methods/test/repro.js#L6-L7
Those two files both depend on packages/babel-helper-create-class-features-plugin/lib/index.js
. packages/babel-helper-create-class-features-plugin/lib/index.js
depends on packages/babel-helper-create-class-features-plugin/lib/fields.js
, and the error I get is about that file:
request for './fields.js' is not yet fulfilled
To Reproduce
Repository link: https://github.com/nicolo-ribaudo/babel/tree/jest-esm-request-not-yet-fulfilled-error
Steps to reproduce:
make bootstrap
node --experimental-vm-modules ./node_modules/.bin/jest babel-plugin-proposal-private-methods/test/repro
Expected behavior
It shouldn't crash
envinfo
System:
OS: Linux 5.8 Ubuntu 20.10 (Groovy Gorilla)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 14.17.0 - /usr/local/bin/node
Yarn: 2.4.1 - /usr/bin/yarn
npm: 7.9.0 - ~/.npm-global/bin/npm
npmPackages:
jest: 27.0.0-next.11 => 27.0.0-next.11
It also fails with Node.js 16.2.0