node/test/es-module
Joyee Cheung f74beb53de
module: cache synchronous module jobs before linking
So that if there are circular dependencies in the synchronous
module graph, they could be resolved using the cached jobs.
In case linking fails and the error gets caught, reset the
cache right after linking. If it succeeds, the caller will
cache it again. Otherwise the error bubbles up to users,
and since we unset the cache for the unlinkable module
the next attempt would still fail.

PR-URL: https://github.com/nodejs/node/pull/52868
Fixes: https://github.com/nodejs/node/issues/52864
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-05-11 18:55:48 +02:00
..
es-module.status Revert "test: set test-esm-loader-resolve-type as flaky" 2023-10-21 15:54:28 +00:00
test-cjs-esm-warn.js test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-cjs-legacyMainResolve-permission.js src,permission: add multiple allow-fs-* flags 2023-08-17 18:39:04 +00:00
test-cjs-legacyMainResolve.js src: do not pass user input to format string 2023-08-01 20:05:51 +00:00
test-cjs-prototype-pollution.js
test-dynamic-import-script-lifetime.js module: use symbol in WeakMap to manage host defined options 2023-09-14 15:42:24 +00:00
test-esm-assert-strict.mjs
test-esm-assertionless-json-import.js esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-basic-imports.mjs
test-esm-child-process-fork-main.mjs
test-esm-cjs-builtins.js
test-esm-cjs-exports.js test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-cjs-load-error-note.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-cjs-main.js
test-esm-cjs-named-error.mjs test: ensure never settling promises are detected 2023-10-23 17:55:50 +00:00
test-esm-custom-exports.mjs
test-esm-cyclic-dynamic-import.mjs
test-esm-data-urls.js esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-default-type.mjs
test-esm-detect-ambiguous.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-dns-promises.mjs
test-esm-double-encoding.mjs
test-esm-dynamic-import-attribute.js esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-dynamic-import-attribute.mjs esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-dynamic-import-commonjs.js esm: do not call getSource when format is commonjs 2023-11-29 09:21:54 +00:00
test-esm-dynamic-import-commonjs.mjs esm: do not call getSource when format is commonjs 2023-11-29 09:21:54 +00:00
test-esm-dynamic-import-mutating-fs.js test,benchmark: use tmpdir.fileURL() 2023-08-21 16:42:03 +00:00
test-esm-dynamic-import-mutating-fs.mjs test,benchmark: use tmpdir.fileURL() 2023-08-21 16:42:03 +00:00
test-esm-dynamic-import.js vm: allow dynamic import with a referrer realm 2023-11-01 06:05:13 +00:00
test-esm-encoded-path-native.js
test-esm-encoded-path.mjs
test-esm-error-cache.js
test-esm-example-loader.mjs
test-esm-experimental-warnings.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-export-not-found.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-exports-deprecations.mjs
test-esm-exports.mjs
test-esm-extension-lookup-deprecation.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-extensionless-esm-and-wasm.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-forbidden-globals.mjs
test-esm-fs-promises.mjs
test-esm-import-assertion-warning.mjs esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-import-attributes-1.mjs esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-import-attributes-2.mjs esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-import-attributes-3.mjs esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-import-attributes-errors.js esm: drop support for import assertions 2024-04-19 17:25:53 +02:00
test-esm-import-attributes-errors.mjs esm: drop support for import assertions 2024-04-19 17:25:53 +02:00
test-esm-import-attributes-validation.js esm: rename error code related to import attributes 2023-10-18 14:27:55 +00:00
test-esm-import-flag.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-import-json-named-export.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-import-meta-resolve.mjs esm: improve error when calling import.meta.resolve from data: URL 2024-01-31 23:22:18 +01:00
test-esm-import-meta.mjs esm: add import.meta.dirname and import.meta.filename 2023-10-31 21:11:15 +00:00
test-esm-imports-deprecations.mjs
test-esm-imports.mjs
test-esm-initialization.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-invalid-data-urls.js lib: fix MIME overmatch in data URLs 2023-08-13 23:24:22 +02:00
test-esm-invalid-pjson.js module,win: fix long path resolve 2024-04-08 14:37:46 +00:00
test-esm-json-cache.mjs esm: use import attributes instead of import assertions 2023-10-14 03:52:38 +00:00
test-esm-json.mjs test: use tmpdir.refresh() in test-esm-json.mjs 2023-12-20 17:47:39 +00:00
test-esm-live-binding.mjs
test-esm-loader-cache-clearing.js
test-esm-loader-chaining.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader-custom-condition.mjs
test-esm-loader-default-resolver.mjs esm: identify parent importing a url with invalid host 2023-09-23 05:41:26 +00:00
test-esm-loader-dependency.mjs
test-esm-loader-event-loop.mjs
test-esm-loader-hooks.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader-http-imports.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader-invalid-format.mjs
test-esm-loader-invalid-url.mjs
test-esm-loader-mock.mjs module: have a single hooks thread for all workers 2024-05-08 07:16:13 +02:00
test-esm-loader-modulemap.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-esm-loader-not-found.mjs
test-esm-loader-programmatically.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader-resolve-type.mjs test: use tmpdir.refresh() in test-esm-loader-resolve-type.mjs 2023-12-20 18:17:31 +00:00
test-esm-loader-search.js
test-esm-loader-spawn-promisified.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader-stringify-text.mjs
test-esm-loader-thenable.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader-threads.mjs module: have a single hooks thread for all workers 2024-05-08 07:16:13 +02:00
test-esm-loader-with-source.mjs esm: do not call getSource when format is commonjs 2023-11-29 09:21:54 +00:00
test-esm-loader-with-syntax-error.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-loader.mjs esm: fix hook name in error message 2023-12-05 19:54:01 +01:00
test-esm-main-lookup.mjs esm: protect ERR_UNSUPPORTED_DIR_IMPORT against prototype pollution 2023-08-11 06:29:14 +00:00
test-esm-module-not-found-commonjs-hint.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-named-exports.js module: have a single hooks thread for all workers 2024-05-08 07:16:13 +02:00
test-esm-named-exports.mjs module: have a single hooks thread for all workers 2024-05-08 07:16:13 +02:00
test-esm-namespace.mjs
test-esm-no-addons.mjs
test-esm-non-js.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-nowarn-exports.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-path-posix.mjs
test-esm-path-win32.mjs
test-esm-pkgname.mjs
test-esm-preserve-symlinks-main.js test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-preserve-symlinks-not-found-plain.mjs
test-esm-preserve-symlinks-not-found.mjs
test-esm-preserve-symlinks.js
test-esm-process.mjs
test-esm-prototype-pollution.mjs
test-esm-recursive-cjs-dependencies.mjs esm: fix loading of CJS modules from ESM 2023-09-06 10:12:14 +00:00
test-esm-repl-imports.js test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-repl.js
test-esm-require-cache.mjs
test-esm-resolve-type.mjs src: do not treat all paths ending with node_modules as such 2023-12-25 11:44:26 +00:00
test-esm-scope-node-modules.mjs
test-esm-shared-loader-dep.mjs
test-esm-shebang.mjs
test-esm-snapshot.mjs
test-esm-source-map.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-symlink-main.js test: use tmpdir.resolve() 2023-08-21 16:41:53 +00:00
test-esm-symlink-type.js
test-esm-symlink.js
test-esm-syntax-error.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-throw-undefined.mjs
test-esm-tla-unfinished.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-tla.mjs
test-esm-type-field-errors.js esm: --experimental-default-type flag to flip module defaults 2023-09-29 06:18:44 +00:00
test-esm-type-field.mjs esm: --experimental-default-type flag to flip module defaults 2023-09-29 06:18:44 +00:00
test-esm-type-flag-cli-entry.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-type-flag-errors.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-type-flag-loose-files.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-type-flag-package-scopes.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-type-flag-string-input.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-type-main.mjs
test-esm-undefined-cjs-global-like-variables.js
test-esm-unknown-extension.js test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-url-extname.js esm: --experimental-default-type flag to flip module defaults 2023-09-29 06:18:44 +00:00
test-esm-util-types.mjs
test-esm-virtual-json.mjs module: have a single hooks thread for all workers 2024-05-08 07:16:13 +02:00
test-esm-wasm.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-esm-windows.js test: use tmpdir.resolve() 2023-08-21 16:41:53 +00:00
test-GH-50753.js module,win: fix long path resolve 2024-04-08 14:37:46 +00:00
test-http-imports-cli.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-http-imports.mjs module: add application/json in accept header when fetching json module 2023-10-30 16:51:52 +00:00
test-loaders-hidden-from-users.js src: implement natives binding without special casing 2023-06-09 15:32:55 +02:00
test-loaders-unknown-builtin-module.mjs
test-loaders-workers-spawned.mjs test: do not set concurrency on parallelized runs 2024-03-23 21:11:28 +00:00
test-require-module-cached-tla.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-conditional-exports.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-cycle-cjs-esm-esm.js module: cache synchronous module jobs before linking 2024-05-11 18:55:48 +02:00
test-require-module-cycle-esm-cjs-esm-esm.js module: disallow CJS <-> ESM edges in a cycle from require(esm) 2024-04-08 14:45:55 +00:00
test-require-module-cycle-esm-cjs-esm.js module: disallow CJS <-> ESM edges in a cycle from require(esm) 2024-04-08 14:45:55 +00:00
test-require-module-cycle-esm-esm-cjs-esm-esm.js module: disallow CJS <-> ESM edges in a cycle from require(esm) 2024-04-08 14:45:55 +00:00
test-require-module-cycle-esm-esm-cjs-esm.js module: disallow CJS <-> ESM edges in a cycle from require(esm) 2024-04-08 14:45:55 +00:00
test-require-module-default-extension.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-detect-entry-point-aou.js module: support ESM detection in the CJS loader 2024-04-30 11:23:07 +02:00
test-require-module-detect-entry-point.js module: support ESM detection in the CJS loader 2024-04-30 11:23:07 +02:00
test-require-module-dont-detect-cjs.js module: support ESM detection in the CJS loader 2024-04-30 11:23:07 +02:00
test-require-module-dynamic-import-1.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-dynamic-import-2.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-dynamic-import-3.js module: fix submodules loaded by require() and import() 2024-04-29 22:46:24 +02:00
test-require-module-dynamic-import-4.js module: fix submodules loaded by require() and import() 2024-04-29 22:46:24 +02:00
test-require-module-errors.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-implicit.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-preload.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-special-import.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-tla.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-twice.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-require-module-with-detection.js module: support ESM detection in the CJS loader 2024-04-30 11:23:07 +02:00
test-require-module.js module: support require()ing synchronous ESM graphs 2024-03-18 18:10:06 +08:00
test-vm-compile-function-leak.js test: use checkIfCollectable in vm leak tests 2023-09-18 23:00:53 +02:00
test-vm-compile-function-lineoffset.js lib: fix compileFunction throws range error for negative numbers 2023-10-06 14:33:46 +00:00
test-vm-contextified-script-leak.js test: deflake test-vm-contextified-script-leak 2023-09-23 03:46:22 +00:00
test-vm-main-context-default-loader.js vm: support using the default loader to handle dynamic import() 2024-02-01 11:45:42 +00:00
test-vm-source-text-module-leak.js v8: implement v8.queryObjects() for memory leak regression testing 2024-03-02 22:11:30 +00:00
test-vm-synthetic-module-leak.js test: use checkIfCollectable in vm leak tests 2023-09-18 23:00:53 +02:00
test-wasm-memory-out-of-bound.js esm: --experimental-default-type flag to flip module defaults 2023-09-29 06:18:44 +00:00
test-wasm-simple.js esm: --experimental-default-type flag to flip module defaults 2023-09-29 06:18:44 +00:00
test-wasm-web-api.js esm: --experimental-default-type flag to flip module defaults 2023-09-29 06:18:44 +00:00
testcfg.py