()
| 66 | } |
| 67 | |
| 68 | async function testModule() { |
| 69 | const ctx = createContext(); |
| 70 | |
| 71 | const mod1 = new SourceTextModule('export const a = 1;', { |
| 72 | context: ctx, |
| 73 | }); |
| 74 | // No import statements, so must not link statically. |
| 75 | await mod1.link(common.mustNotCall()); |
| 76 | |
| 77 | const mod2 = new SourceTextModule(` |
| 78 | const promise = import("mod1"); |
| 79 | if (Object.getPrototypeOf(promise) !== Promise.prototype) { |
| 80 | throw new Error('Expected promise to be created in the current context'); |
| 81 | } |
| 82 | await promise; |
| 83 | `, { |
| 84 | context: ctx, |
| 85 | importModuleDynamically: common.mustCall((specifier, referrer) => { |
| 86 | assert.strictEqual(specifier, 'mod1'); |
| 87 | assert.strictEqual(referrer, mod2); |
| 88 | return mod1; |
| 89 | }), |
| 90 | }); |
| 91 | // No import statements, so must not link statically. |
| 92 | await mod2.link(common.mustNotCall()); |
| 93 | await mod2.evaluate(); |
| 94 | } |
| 95 | |
| 96 | async function testModuleImportFailed() { |
| 97 | const ctx = createContext(); |
no test coverage detected
searching dependent graphs…