Skip to content

Commit f55b79f

Browse files
committed
fixup! inspector port is actually needed
1 parent 12d6e4c commit f55b79f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

examples/common/apps.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ export function getAppPort(app: AppName, { isWorker = true } = {}) {
3131
}
3232
return isWorker ? BASE_WRANGLER_PORT + index : BASE_NEXT_PORT + index;
3333
}
34+
35+
/**
36+
* Returns a distinct port for each application so they can run in parallel.
37+
*/
38+
export function getInspectorPort(app: AppName) {
39+
const index = apps.indexOf(app);
40+
if (index === -1) {
41+
throw new Error(`Unknown app: ${app}`);
42+
}
43+
return 9300 + index;
44+
}

examples/common/config-e2e.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig, devices } from "@playwright/test";
22
import type nodeProcess from "node:process";
3-
import { getAppPort, type AppName } from "./apps";
3+
import { getAppPort, getInspectorPort, type AppName } from "./apps";
44

55
declare const process: typeof nodeProcess;
66

@@ -16,13 +16,14 @@ export function configurePlaywright(
1616
} = {}
1717
) {
1818
const port = getAppPort(app, { isWorker });
19+
const inspectorPort = getInspectorPort(app);
1920
const baseURL = `http://localhost:${port}`;
2021
let command: string;
2122
let timeout: number;
2223
if (isWorker) {
2324
if (isCI) {
2425
// Do not build on CI - there is a preceding build step
25-
command = `pnpm wrangler dev --port ${port}`;
26+
command = `pnpm wrangler dev --port ${port} --inspector-port ${inspectorPort}`;
2627
timeout = 100_000;
2728
} else {
2829
timeout = 500_000;

0 commit comments

Comments
 (0)