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

Function test

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

Source from the content-addressed store, hash-verified

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