Open tuanbass opened 1 year ago
It's caused by an open issue in node:
https://github.com/nodejs/node/issues/35889 actually the problem in V8 js engine https://bugs.chromium.org/p/chromium/issues/detail?id=1238312
Cause: when running test suites, jest try to isolate the running environment for each suite. to do so, it uses VM from nodejs (actually Chrome V8 js engine). However, the VM module is experiment and contains a crash bug (which openned for ~ 2 years). See detail in the above link.
Proposal: Use another Jest runner just does not use VM module. Impact: Suite isolation must be cared by the dev
Something not supported by jest-light-runner
In case of switch back to CJS, there are some toys used to convert 3rd party lib which support only esm to cjs
https://www.reddit.com/r/javascript/comments/wrl0n6/tired_of_your_favorite_packages_being_esmonly_i/
Workaround could be: Using runner: 'jest-light-runner',
Impact:
Fixed in commit https://github.com/aura-nw/moleculer-ts-base/commit/aadaa6cd9e6098c572f54e35dc326a137917f214
I will have this issue opened to track the upstream issue with jest and V8 above
few other solution to try:
https://gist.github.com/rstacruz/511f43265de4939f6ca729a3df7b001c
When running test require VM module (knex for sample), sometime jest is crashed.