(url, context, next)
| 56 | } |
| 57 | |
| 58 | export async function load(url, context, next) { |
| 59 | loadCalls++; |
| 60 | const source = await readFile(fileURLToPath(url)); |
| 61 | let format; |
| 62 | |
| 63 | if (loadCalls === 1) { |
| 64 | assert.match(url, /json-modules\.mjs$/); |
| 65 | assert.deepStrictEqual(context.importAttributes, {}); |
| 66 | format = 'module'; |
| 67 | } else if (loadCalls === 2) { |
| 68 | assert.match(url, /experimental\.json$/); |
| 69 | assert.deepStrictEqual(context.importAttributes, { |
| 70 | type: 'json', |
| 71 | }); |
| 72 | format = 'json'; |
| 73 | } |
| 74 | |
| 75 | assert.ok(new URL(url)); |
| 76 | // Ensure `context` has all and only the properties it's supposed to |
| 77 | assert.deepStrictEqual(Reflect.ownKeys(context), [ |
| 78 | 'format', |
| 79 | 'importAttributes', |
| 80 | 'importAssertions', |
| 81 | ]); |
| 82 | assert.strictEqual(context.format, 'test'); |
| 83 | assert.strictEqual(typeof next, 'function'); |
| 84 | |
| 85 | const returnValue = { |
| 86 | source, |
| 87 | format, |
| 88 | shortCircuit: true, |
| 89 | }; |
| 90 | |
| 91 | writeSync(1, JSON.stringify(returnValue) + '\n'); // For the test to validate when it parses stdout |
| 92 | |
| 93 | return returnValue; |
| 94 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…