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

Function depth

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

Source from the content-addressed store, hash-verified

45}
46
47async function depth() {
48 const foo = new SourceTextModule('export default 5');
49 await foo.link(common.mustNotCall());
50
51 async function getProxy(parentName, parentModule) {
52 const mod = new SourceTextModule(`
53 import ${parentName} from '${parentName}';
54 export default ${parentName};
55 `);
56 await mod.link(common.mustCall((specifier, module) => {
57 assert.strictEqual(module, mod);
58 assert.strictEqual(specifier, parentName);
59 return parentModule;
60 }));
61 return mod;
62 }
63
64 const bar = await getProxy('foo', foo);
65 const baz = await getProxy('bar', bar);
66 const barz = await getProxy('baz', baz);
67
68 await barz.evaluate();
69
70 assert.strictEqual(barz.namespace.default, 5);
71}
72
73async function circular() {
74 const foo = new SourceTextModule(`

Callers 1

Calls 3

getProxyFunction · 0.70
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…