MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/es-module/test-require-module-tla-retry-import.js:8–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7let ns;
8async function test() {
9 assert.throws(() => {
10 require('../fixtures/es-modules/tla/export-async.mjs');
11 }, {
12 code: 'ERR_REQUIRE_ASYNC_MODULE',
13 });
14 const newNs = await import('../fixtures/es-modules/tla/export-async.mjs');
15 if (ns === undefined) {
16 ns = newNs;
17 } else {
18 // Check that re-evalaution is returning the same namespace.
19 assert.strictEqual(ns, newNs);
20 }
21 assert.strictEqual(ns.hello, 'world');
22}
23
24// Run the test twice to check consistency after caching.
25test().then(test).then(common.mustCall());

Calls 1

requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…