Start the smoke test server on the port in SMOKE_URL
Two checkouts can then run their smoke tests at the same time.
This commit is contained in:
+1
-1
@@ -179,7 +179,7 @@ A test states what it needs near its top. The runner skips the test, with the re
|
|||||||
|
|
||||||
| Variable | Use |
|
| 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_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. |
|
| `RUNESTONE_TERMINAL_DIST` | The compiled Terminal plugin. The default is `RuneStone_Terminal/dist` in that folder. |
|
||||||
| `CHROME_PATH` | A Chromium browser for Playwright |
|
| `CHROME_PATH` | A Chromium browser for Playwright |
|
||||||
|
|||||||
+3
-1
@@ -115,7 +115,9 @@ async function reachable(url) {
|
|||||||
|
|
||||||
async function startServer() {
|
async function startServer() {
|
||||||
const vite = path.join(root, "node_modules", "vite", "bin", "vite.js");
|
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) {
|
for (let waited = 0; waited < 60000; waited += 500) {
|
||||||
if (await reachable(env.SMOKE_URL)) return server;
|
if (await reachable(env.SMOKE_URL)) return server;
|
||||||
await new Promise(resolve => setTimeout(resolve, 500));
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||||||
|
|||||||
Reference in New Issue
Block a user