You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Mocha is used to run test files written in Typescript along with --import=@swc-node/register/esm-register, the following kind of error gets thrown:
ReferenceError: require is not defined in ES module scope, you can use import instead
at file:///path/to/swc-node-register-mocha-bug/node_modules/mocha/bin/mocha.js:9:29
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
A specific minimal-ish reproduce can be found in this repository. In case that reproduce does not use @swc-node/register as it is intended to be used, I'm happy to adjust it and potentially close this issue.
This issue relates to #762 which got fixed initially, and the fix did work, but the subsequent 1.9.1 release of @swc-node/register led to this other error.
The text was updated successfully, but these errors were encountered:
When Mocha is used to run test files written in Typescript along with
--import=@swc-node/register/esm-register
, the following kind of error gets thrown:A specific minimal-ish reproduce can be found in this repository. In case that reproduce does not use
@swc-node/register
as it is intended to be used, I'm happy to adjust it and potentially close this issue.This issue relates to #762 which got fixed initially, and the fix did work, but the subsequent
1.9.1
release of@swc-node/register
led to this other error.The text was updated successfully, but these errors were encountered: