(options)
| 41 | } |
| 42 | |
| 43 | async function testLoader(options) { |
| 44 | { |
| 45 | // Import built-in modules |
| 46 | const script = new Script('import("fs")', options); |
| 47 | let result = await script.runInThisContext(); |
| 48 | assert.strictEqual(result.constants.F_OK, fs.constants.F_OK); |
| 49 | |
| 50 | const imported = compileFunction('return import("fs")', [], options)(); |
| 51 | result = await imported; |
| 52 | assert.strictEqual(result.constants.F_OK, fs.constants.F_OK); |
| 53 | } |
| 54 | |
| 55 | const moduleUrl = fixtures.fileURL('es-modules', 'message.mjs'); |
| 56 | fs.copyFileSync(moduleUrl, tmpdir.resolve('message.mjs')); |
| 57 | |
| 58 | { |
| 59 | const namespace = await import(moduleUrl); |
| 60 | const script = new Script('import("./message.mjs")', options); |
| 61 | const result = await script.runInThisContext(); |
| 62 | assert.deepStrictEqual(result, namespace); |
| 63 | } |
| 64 | |
| 65 | { |
| 66 | const namespace = await import(moduleUrl); |
| 67 | const imported = compileFunction('return import("./message.mjs")', [], options)(); |
| 68 | const result = await imported; |
| 69 | assert.deepStrictEqual(result, namespace); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | async function main() { |
| 74 | { |
no test coverage detected
searching dependent graphs…