node/test/fixtures/es-modules/test-wasm-source-phase-not-defined-dynamic.mjs
Joyee Cheung 76027d83e9
test: split test-esm-wasm.js
The test has been flaking due to either timeout or calling
uv_async_send on a closing/closed handle. As the test squeezes
too many independent test cases in one file, split it up to
avoid timing out on slower machines and aid debugging.

PR-URL: https://github.com/nodejs/node/pull/60491
Refs: https://github.com/nodejs/reliability/blob/main/reports/2025-10-29.md
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-11-05 10:36:31 +00:00

13 lines
581 B
JavaScript

// Test fixture that throws when source phase not defined for dynamic import
import { ok, strictEqual, rejects } from 'node:assert';
import { fileURLToPath } from 'node:url';
import { pathToFileURL } from 'node:url';
const fileUrl = pathToFileURL(fileURLToPath(new URL('./wasm-source-phase.js', import.meta.url))).href;
await rejects(import.source(fileUrl), (e) => {
strictEqual(e instanceof SyntaxError, true);
strictEqual(e.message.includes('Source phase import object is not defined for module'), true);
strictEqual(e.message.includes(fileUrl), true);
return true;
});