()
| 8 | const { Script, SourceTextModule } = require('vm'); |
| 9 | |
| 10 | async function testNoCallback() { |
| 11 | const m = new SourceTextModule(` |
| 12 | globalThis.importResult = import("foo"); |
| 13 | globalThis.importResult.catch(() => {}); |
| 14 | `); |
| 15 | await m.link(common.mustNotCall()); |
| 16 | await m.evaluate(); |
| 17 | let threw = false; |
| 18 | try { |
| 19 | await globalThis.importResult; |
| 20 | } catch (err) { |
| 21 | threw = true; |
| 22 | assert.strictEqual(err.code, 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING'); |
| 23 | } |
| 24 | delete globalThis.importResult; |
| 25 | assert(threw); |
| 26 | } |
| 27 | |
| 28 | async function test() { |
| 29 | const foo = new SourceTextModule('export const a = 1;'); |
no test coverage detected
searching dependent graphs…