(specifier, context, defaultResolve)
| 68 | |
| 69 | // Rewrites node: loading to mock-facade: so that it can be intercepted |
| 70 | export async function resolve(specifier, context, defaultResolve) { |
| 71 | doDrainPort(); |
| 72 | const def = await defaultResolve(specifier, context); |
| 73 | if (context.parentURL?.startsWith('mock-facade:')) { |
| 74 | // Do nothing, let it get the "real" module |
| 75 | } else if (mockedModuleExports.has(def.url)) { |
| 76 | return { |
| 77 | shortCircuit: true, |
| 78 | url: `mock-facade:${currentMockVersion}:${encodeURIComponent(def.url)}` |
| 79 | }; |
| 80 | }; |
| 81 | return { |
| 82 | shortCircuit: true, |
| 83 | url: def.url, |
| 84 | }; |
| 85 | } |
| 86 | |
| 87 | export async function load(url, context, defaultLoad) { |
| 88 | doDrainPort(); |
no test coverage detected