()
| 74 | } |
| 75 | |
| 76 | async function testInvalid() { |
| 77 | const m = new SourceTextModule('globalThis.fooResult = import("foo")', { |
| 78 | importModuleDynamically: common.mustCall((specifier, wrap) => { |
| 79 | return 5; |
| 80 | }), |
| 81 | }); |
| 82 | await m.link(common.mustNotCall()); |
| 83 | await m.evaluate(); |
| 84 | await globalThis.fooResult.catch(common.mustCall((e) => { |
| 85 | assert.strictEqual(e.code, 'ERR_VM_MODULE_NOT_MODULE'); |
| 86 | })); |
| 87 | delete globalThis.fooResult; |
| 88 | |
| 89 | const s = new Script('import("bar")', { |
| 90 | importModuleDynamically: common.mustCall((specifier, wrap) => { |
| 91 | return undefined; |
| 92 | }), |
| 93 | }); |
| 94 | let threw = false; |
| 95 | try { |
| 96 | await s.runInThisContext(); |
| 97 | } catch (e) { |
| 98 | threw = true; |
| 99 | assert.strictEqual(e.code, 'ERR_VM_MODULE_NOT_MODULE'); |
| 100 | } |
| 101 | assert(threw); |
| 102 | } |
| 103 | |
| 104 | async function testInvalidimportModuleDynamically() { |
| 105 | assert.throws( |
no test coverage detected
searching dependent graphs…