(userRunner)
| 3 | import { createServer, createServerModuleRunner } from 'vite' |
| 4 | |
| 5 | async function runTest(userRunner) { |
| 6 | const server = await createServer({ |
| 7 | configFile: false, |
| 8 | root: fileURLToPath(new URL('.', import.meta.url)), |
| 9 | server: { |
| 10 | middlewareMode: true, |
| 11 | ws: false, |
| 12 | }, |
| 13 | }) |
| 14 | let mod |
| 15 | if (userRunner) { |
| 16 | const runner = await createServerModuleRunner(server.environments.ssr, { |
| 17 | hmr: false, |
| 18 | }) |
| 19 | mod = await runner.import('/src/network-imports.js') |
| 20 | } else { |
| 21 | mod = await server.ssrLoadModule('/src/network-imports.js') |
| 22 | } |
| 23 | assert.equal(mod.slash('foo\\bar'), 'foo/bar') |
| 24 | await server.close() |
| 25 | } |
| 26 | |
| 27 | runTest(process.argv.includes('--module-runner')) |
no test coverage detected