node/test/module-hooks
Joyee Cheung e75617d25f
test: split test-esm-loader-hooks
Previously whenever one of the test case fails in the CI, it
barely logged anything useful in the CI and it was difficult to
nail down the specific failing case with a local reproduction,
especially when the test fixutre is inline JavaScript. This patch:

- Puts all the inline JavaScript in on-disk fixtures so that
  they can be re-run easily.
- Split the tests into individual files so that it's easier to nail
  down the failure
- Use spawnSyncAndAssert which logs useful information when the child
  process does not behave as expected.
- Rename the tests as module-hooks/test-async-loader-hooks-* because
  they belong to the module hooks test suite and are not esm-specific.

PR-URL: https://github.com/nodejs/node/pull/61374
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-01-13.md
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-01-27 22:52:26 +01:00
..
module-hooks.status
test-async-loader-hooks-called-with-expected-args.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-called-with-register.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-globalpreload-no-warning-with-initialize.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-globalpreload-warning.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-initialize-in-sequence.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-initialize-invoke.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-initialize-never-settling.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-initialize-process-exit.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-initialize-rejecting.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-initialize-throw-null.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-mixed-opt-in.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-import-meta-resolve.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-load-cjs.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-load-esm-no-warning.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-load-esm-with-warning.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-race-cjs.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-race-esm.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-resolve-cjs.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-resolve-esm-no-warning.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-never-settling-resolve-esm-with-warning.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-no-leak-internals.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-process-exit-async.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-process-exit-sync.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-process-exit-top-level.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-register-with-cjs.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-register-with-import.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-register-with-ports.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-register-with-require.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-register-with-url-parenturl.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-remove-beforeexit-listener.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-require-resolve-default.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-require-resolve-opt-in.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-source-maps-cjs.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-bigint.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-boolean.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-empty-object.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-error.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-function.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-null.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-number.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-object.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-string.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-symbol.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-throw-undefined.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-use-hooks-require-esm.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-with-worker-permission-allowed.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-with-worker-permission-restricted.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-async-loader-hooks-without-worker-permission.mjs test: split test-esm-loader-hooks 2026-01-27 22:52:26 +01:00
test-module-hooks-builtin-require.js lib,src,test: fix tests without SQLite 2026-01-27 22:50:36 +01:00
test-module-hooks-create-require-with-url.mjs module: preserve URL in the parent created by createRequire() 2026-01-19 19:19:23 +01:00
test-module-hooks-custom-conditions-cjs.js test: ensure assertions are reached on more tests 2026-01-19 19:18:57 +01:00
test-module-hooks-custom-conditions-special-values.js module: fix conditions override in synchronous resolve hooks 2025-07-27 23:52:52 +02:00
test-module-hooks-custom-conditions.mjs test: ensure assertions are reached on more tests 2026-01-19 19:18:57 +01:00
test-module-hooks-import-wasm.mjs tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-load-async-and-sync.js module: handle null source from async loader hooks in sync hooks 2025-11-07 18:11:30 +01:00
test-module-hooks-load-buffers.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-load-builtin-import.mjs
test-module-hooks-load-builtin-override-commonjs.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-load-builtin-override-json.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-load-builtin-override-module.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-load-builtin-require.js lib,src,test: fix tests without SQLite 2026-01-27 22:50:36 +01:00
test-module-hooks-load-chained.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-load-context-merged-esm.mjs module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-load-context-merged.js module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-load-context-optional-esm.mjs module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-load-context-optional.js module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-load-detection.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-load-esm-mock.js tools,test: enforce best practices to detect never settling promises 2025-07-17 16:57:14 +02:00
test-module-hooks-load-esm.js tools,test: enforce best practices to detect never settling promises 2025-07-17 16:57:14 +02:00
test-module-hooks-load-invalid.js
test-module-hooks-load-mock.js
test-module-hooks-load-short-circuit-required-middle.js
test-module-hooks-load-short-circuit-required-start.js
test-module-hooks-load-short-circuit.js
test-module-hooks-load-url-change-import.mjs tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-load-url-change-require.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-preload.js
test-module-hooks-require-esm.js esm: use sync loading/resolving on non-loader-hook thread 2025-11-13 22:44:15 +01:00
test-module-hooks-require-wasm.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-resolve-builtin-builtin-import.mjs
test-module-hooks-resolve-builtin-builtin-require.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-resolve-builtin-on-disk-import.mjs
test-module-hooks-resolve-builtin-on-disk-require-with-prefix.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-resolve-builtin-on-disk-require.js tools: add lint rule to ensure assertions are reached 2025-11-12 00:15:32 +01:00
test-module-hooks-resolve-context-merged-esm.mjs module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-resolve-context-merged.js module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-resolve-context-optional-esm.mjs module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-resolve-context-optional.js module: allow omitting context in synchronous next hooks 2025-02-18 15:28:59 +00:00
test-module-hooks-resolve-invalid.js
test-module-hooks-resolve-load-builtin-override-both-prefix.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-resolve-load-builtin-override-both.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-resolve-load-builtin-redirect-prefix.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-resolve-load-builtin-redirect.js module: fix sync resolve hooks for require with node: prefixes 2026-01-19 19:19:27 +01:00
test-module-hooks-resolve-load-import-inline-typescript-override.mjs
test-module-hooks-resolve-load-import-inline-typescript.mjs
test-module-hooks-resolve-load-require-inline-typescript-override.js
test-module-hooks-resolve-load-require-inline-typescript.js
test-module-hooks-resolve-short-circuit-required-middle.js
test-module-hooks-resolve-short-circuit-required-start.js
test-module-hooks-resolve-short-circuit.js
testcfg.py