Skip to content

Commit 8288494

Browse files
MyNameIsEdiclaude
andauthored
fix(server): revert playwright spawn to npx — node cli.js exits immediately on Windows (#124)
Direct node spawn with shell:false does not replicate the Windows console handle inheritance that cmd.exe provides; playwright exits with no output. Reverts to npx playwright with shell:true on win32. The non-blocking remote warmup (the real startup speedup) is preserved. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b705930 commit 8288494

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

server/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ app.get('/api/playwright/artifacts', (_req, res) => {
11371137
}
11381138
});
11391139

1140+
11401141
app.post('/api/playwright/run', async (req, res) => {
11411142
const {
11421143
spec,
@@ -1250,13 +1251,10 @@ app.post('/api/playwright/run', async (req, res) => {
12501251
})();
12511252
}
12521253

1253-
// Use the local playwright CLI directly — avoids npx resolution overhead
1254-
// (saves 30-90s on Windows where npx+shell startup is expensive).
1255-
const pwCli = path.join(root, 'node_modules', '@playwright', 'test', 'cli.js');
1256-
const child = spawn(process.execPath, [pwCli, ...args], {
1254+
const child = spawn('npx', ['playwright', ...args], {
12571255
cwd: root,
12581256
env,
1259-
shell: false,
1257+
shell: process.platform === 'win32',
12601258
});
12611259

12621260
// Capture log lines so they're (a) persisted with the archived run and
@@ -1590,11 +1588,10 @@ app.post('/api/run-dynamic-test', async (req, res) => {
15901588
PW_RUNTIME_CONFIG: JSON.stringify({ testMatch: ['**/_dynamic_agent_test.spec.ts'] }),
15911589
};
15921590

1593-
const pwCli = path.join(root, 'node_modules', '@playwright', 'test', 'cli.js');
1594-
const child = spawn(process.execPath, [pwCli, 'test'], {
1591+
const child = spawn('npx', ['playwright', 'test'], {
15951592
cwd: root,
15961593
env,
1597-
shell: false,
1594+
shell: process.platform === 'win32',
15981595
});
15991596

16001597
// Capture every log line so we can persist them with the archived run.

0 commit comments

Comments
 (0)