()
| 71 | } |
| 72 | |
| 73 | async 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 | |
| 102 | async function circular2() { |
| 103 | const sourceMap = { |
no test coverage detected
searching dependent graphs…