🛠 Repo: Test failures in test-node:integration with Node.js 22 #5213
Labels
area: repository tooling
concerning ease of contribution
status: accepting prs
Mocha can use your help with this one!
type: chore
generally involving deps, tooling, configuration, etc.
Tooling Suggestion Checklist
main
branch of the repository.faq
label, but none matched my issue.Overview
Examples from https://github.com/mochajs/mocha/actions/runs/10822537285/job/30049014667:
Full, long output here...
323 passing (2m) 1 pending 2 failingshould throw an ERR_MODULE_NOT_FOUND and not ERR_REQUIRE_ESM if file imports a non-existing module with a loader:
expected '(node:2221) ExperimentalWarning:
--experimental-loader
may be removed in the future; instead useregister()
:\n--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));'\n at createModuleLoader (node:internal/modules/esm/loader:710:17)\n at Object.getOrInitializeCascadedLoader (node:internal/modules/esm/loader:754:22)\n at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:106:65)\n at runEntryPointWithESMLoader (node:internal/modules/run_main:139:19)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:5)\n at node:internal/main/run_main_module:30:49\n\n Exception during run: Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\nPlease open an issue with this stack trace at https://github.com/nodejs/node/issues\n\n at assert (node:internal/assert:14:11)\n at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:329:5)\n at new ModuleJobSync (node:internal/modules/esm/module_job:313:34)\n at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:314:11)\n at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)\n at Module._compile (node:internal/modules/cjs/loader:1503:5)\n at Module.replacementCompile (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:60:13)\n at module.exports (/home/runner/work/mocha/mocha/node_modules/default-require-extensions/js.js:7:9)\n at Object. (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:64:4)\n at Module.load (node:internal/modules/cjs/loader:1317:32)\n at Module._load (node:internal/modules/cjs/loader:1127:12)\n at TracingChannel.traceSync (node:diagnostics_channel:315:14)\n at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)\n at Module.require (node:internal/modules/cjs/loader:1339:12)\n at require (node:internal/modules/helpers:135:16)\n at exports.requireOrImport (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:10:8)\n at async exports.loadFilesAsync (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:21:688)\n at async singleRun (/home/runner/work/mocha/mocha/lib/cli/run-helpers.js:55:26)\n at async exports.handler (/home/runner/work/mocha/mocha/lib/cli/run.js:19:452) {\n code: 'ERR_INTERNAL_ASSERTION'\n}\n'to contain 'ERR_MODULE_NOT_FOUND'
(node:2221) ExperimentalWarning:
--experimental-loader
may be removed in the future; instead useregister()
:--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));'
at createModuleLoader (node:internal/modules/esm/loader:710:17)
at Object.getOrInitializeCascadedLoader (node:internal/modules/esm/loader:754:22)
at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:106:65)
at runEntryPointWithESMLoader (node:internal/modules/run_main:139:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:5)
at node:internal/main/run_main_module:30:49
Exception during run: Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
^^^^
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
code: 'ERR_INTERNAL_ASSERTION'
^^^^
}
UnexpectedError:
expected '(node:2221) ExperimentalWarning:
--experimental-loader
may be removed in the future; instead useregister()
:\n--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));'\n at createModuleLoader (node:internal/modules/esm/loader:710:17)\n at Object.getOrInitializeCascadedLoader (node:internal/modules/esm/loader:754:22)\n at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:106:65)\n at runEntryPointWithESMLoader (node:internal/modules/run_main:139:19)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:5)\n at node:internal/main/run_main_module:30:49\n\n Exception during run: Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.\nPlease open an issue with this stack trace at https://github.com/nodejs/node/issues\n\n at assert (node:internal/assert:14:11)\n at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:329:5)\n at new ModuleJobSync (node:internal/modules/esm/module_job:313:34)\n at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:314:11)\n at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)\n at Module._compile (node:internal/modules/cjs/loader:1503:5)\n at Module.replacementCompile (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:60:13)\n at module.exports (/home/runner/work/mocha/mocha/node_modules/default-require-extensions/js.js:7:9)\n at Object. (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:64:4)\n at Module.load (node:internal/modules/cjs/loader:1317:32)\n at Module._load (node:internal/modules/cjs/loader:1127:12)\n at TracingChannel.traceSync (node:diagnostics_channel:315:14)\n at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)\n at Module.require (node:internal/modules/cjs/loader:1339:12)\n at require (node:internal/modules/helpers:135:16)\n at exports.requireOrImport (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:10:8)\n at async exports.loadFilesAsync (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:21:688)\n at async singleRun (/home/runner/work/mocha/mocha/lib/cli/run-helpers.js:55:26)\n at async exports.handler (/home/runner/work/mocha/mocha/lib/cli/run.js:19:452) {\n code: 'ERR_INTERNAL_ASSERTION'\n}\n'to contain 'ERR_MODULE_NOT_FOUND'
(node:2221) ExperimentalWarning:
--experimental-loader
may be removed in the future; instead useregister()
:--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("./test/integration/fixtures/esm/loader-with-module-not-found/loader-that-recognizes-ts.mjs", pathToFileURL("./"));'
at createModuleLoader (node:internal/modules/esm/loader:710:17)
at Object.getOrInitializeCascadedLoader (node:internal/modules/esm/loader:754:22)
at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:106:65)
at runEntryPointWithESMLoader (node:internal/modules/run_main:139:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:5)
at node:internal/main/run_main_module:30:49
Exception during run: Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
^^^^
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
}
when mocha run in serial mode
support ESM via .js extension w/o type=module
should fail due to ambiguous file type:
expected Promise when fulfilled to contain output /SyntaxError: Unexpected token/
expected
{
output: '\n✖ \x1b[31mERROR:\x1b[39m Error [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /home/runner/work/mocha/mocha/test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js in a cycle.\n at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:303:15)\n at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)\n at Module._compile (node:internal/modules/cjs/loader:1503:5)\n at Module.replacementCompile (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:60:13)\n at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)\n at Object. (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:64:4)\n at Module.load (node:internal/modules/cjs/loader:1317:32)\n at Module._load (node:internal/modules/cjs/loader:1127:12)\n at TracingChannel.traceSync (node:diagnostics_channel:315:14)\n at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)\n at cjsLoader (node:internal/modules/esm/translators:329:5)\n at ModuleWrap. (node:internal/modules/esm/translators:260:7)\n at ModuleJob.run (node:internal/modules/esm/module_job:262:25)\n at async onImport.tracePromise.proto (node:internal/modules/esm/loader:482:26)\n at async formattedImport (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:2:567)\n at async exports.requireOrImport (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:7:1135)\n at async exports.handleRequires (/home/runner/work/mocha/mocha/lib/cli/run-helpers.js:38:372)\n at async /home/runner/work/mocha/mocha/lib/cli/run.js:18:40 {\n code: 'ERR_REQUIRE_CYCLE_MODULE'\n}\n',
code: 1,
args: [
'/home/runner/work/mocha/mocha/bin/mocha.js',
'--require=/home/runner/work/mocha/mocha/test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js',
'--no-color',
'--no-bail',
'--no-parallel'
],
command: '/home/runner/work/mocha/mocha/bin/mocha.js --require=/home/runner/work/mocha/mocha/test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js --no-color --no-bail --no-parallel'
}
to contain output /SyntaxError: Unexpected token/
expected Promise when fulfilled to contain output /SyntaxError: Unexpected token/
expected
{
output: '\n✖ \x1b[31mERROR:\x1b[39m Error [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /home/runner/work/mocha/mocha/test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js in a cycle.\n at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:303:15)\n at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)\n at Module._compile (node:internal/modules/cjs/loader:1503:5)\n at Module.replacementCompile (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:60:13)\n at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)\n at Object. (/home/runner/work/mocha/mocha/node_modules/append-transform/index.js:64:4)\n at Module.load (node:internal/modules/cjs/loader:1317:32)\n at Module._load (node:internal/modules/cjs/loader:1127:12)\n at TracingChannel.traceSync (node:diagnostics_channel:315:14)\n at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)\n at cjsLoader (node:internal/modules/esm/translators:329:5)\n at ModuleWrap. (node:internal/modules/esm/translators:260:7)\n at ModuleJob.run (node:internal/modules/esm/module_job:262:25)\n at async onImport.tracePromise.proto (node:internal/modules/esm/loader:482:26)\n at async formattedImport (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:2:567)\n at async exports.requireOrImport (/home/runner/work/mocha/mocha/lib/nodejs/esm-utils.js:7:1135)\n at async exports.handleRequires (/home/runner/work/mocha/mocha/lib/cli/run-helpers.js:38:372)\n at async /home/runner/work/mocha/mocha/lib/cli/run.js:18:40 {\n code: 'ERR_REQUIRE_CYCLE_MODULE'\n}\n',
code: 1,
args: [
'--require=/home/runner/work/mocha/mocha/test/integration/fixtures/plugins/root-hooks/root-hook-defs-esm-broken.fixture.js',
'--no-color',
'--no-bail',
'--no-parallel'
],
}
to contain output /SyntaxError: Unexpected token/
at Array.forEach ()
From previous event:
at Context. (test/integration/plugins/root-hooks.spec.js:140:16)
at callFn (lib/runnable.js:110:584)
at Runnable.run (lib/runnable.js:110:57)
at Runner.runTest (lib/runner.js:182:1028)
at /home/runner/work/mocha/mocha/lib/runner.js:210:639
at next (lib/runner.js:159:412)
at /home/runner/work/mocha/mocha/lib/runner.js:159:789
at next (lib/runner.js:147:565)
at Immediate. (lib/runner.js:151:1226)
at process.processImmediate (node:internal/timers:491:21)
set UNEXPECTED_FULL_TRACE=true to see the full stack trace
Additional Info
No response
The text was updated successfully, but these errors were encountered: