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

Function circular

test/parallel/test-vm-module-link.js:73–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71}
72
73async function circular() {
74 const foo = new SourceTextModule(`
75 import getFoo from 'bar';
76 export let foo = 42;
77 export default getFoo();
78 `);
79 const bar = new SourceTextModule(`
80 import { foo } from 'foo';
81 export default function getFoo() {
82 return foo;
83 }
84 `);
85 await foo.link(common.mustCall(async (specifier, module) => {
86 if (specifier === 'bar') {
87 assert.strictEqual(module, foo);
88 return bar;
89 }
90 assert.strictEqual(specifier, 'foo');
91 assert.strictEqual(module, bar);
92 assert.strictEqual(foo.status, 'linking');
93 return foo;
94 }, 2));
95
96 assert.strictEqual(bar.status, 'linked');
97
98 await foo.evaluate();
99 assert.strictEqual(foo.namespace.default, 42);
100}
101
102async function circular2() {
103 const sourceMap = {

Callers 1

Calls 2

linkMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…