()
| 49 | } |
| 50 | |
| 51 | async function testMissing() { |
| 52 | const ctx = createContext({}); |
| 53 | { |
| 54 | const s = new Script('Promise.resolve("import(\'foo\')").then(eval)', { |
| 55 | importModuleDynamically: common.mustNotCall(), |
| 56 | }); |
| 57 | |
| 58 | const result = s.runInContext(ctx); |
| 59 | await assert.rejects(result, { |
| 60 | code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING', |
| 61 | }); |
| 62 | } |
| 63 | |
| 64 | { |
| 65 | const m = new SourceTextModule('globalThis.fooResult = Promise.resolve("import(\'foo\')").then(eval)', { |
| 66 | context: ctx, |
| 67 | importModuleDynamically: common.mustNotCall(), |
| 68 | }); |
| 69 | await m.link(common.mustNotCall()); |
| 70 | await m.evaluate(); |
| 71 | |
| 72 | await assert.rejects(ctx.fooResult, { |
| 73 | code: 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING', |
| 74 | }); |
| 75 | delete ctx.fooResult; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | await Promise.all([ |
| 80 | test(), |
no test coverage detected