diff --git a/docs/development.md b/docs/development.md index 748a159..4af5192 100644 --- a/docs/development.md +++ b/docs/development.md @@ -179,7 +179,7 @@ A test states what it needs near its top. The runner skips the test, with the re | Variable | Use | | --- | --- | -| `SMOKE_URL` | The frontend address. The default is `http://127.0.0.1:1420`. | +| `SMOKE_URL` | The frontend address. The default is `http://127.0.0.1:1420`. When the runner starts Vite, it uses the port of this address, so two checkouts can run tests at the same time. | | `RUNESTONE_PLUGIN_REPOS` | The folder of the sibling plugin checkouts. The default is the parent folder of this repository. | | `RUNESTONE_TERMINAL_DIST` | The compiled Terminal plugin. The default is `RuneStone_Terminal/dist` in that folder. | | `CHROME_PATH` | A Chromium browser for Playwright | diff --git a/scripts/smoke.mjs b/scripts/smoke.mjs index 843f6f0..71c9ff4 100644 --- a/scripts/smoke.mjs +++ b/scripts/smoke.mjs @@ -115,7 +115,9 @@ async function reachable(url) { async function startServer() { const vite = path.join(root, "node_modules", "vite", "bin", "vite.js"); - const server = spawn(process.execPath, [vite, "dev"], { cwd: root, stdio: "ignore", windowsHide: true }); + // Serve on the port in SMOKE_URL, so that two checkouts can run their tests at the same time. + const port = new URL(env.SMOKE_URL).port || "1420"; + const server = spawn(process.execPath, [vite, "dev", "--port", port, "--strictPort"], { cwd: root, stdio: "ignore", windowsHide: true }); for (let waited = 0; waited < 60000; waited += 500) { if (await reachable(env.SMOKE_URL)) return server; await new Promise(resolve => setTimeout(resolve, 500));