fix(windows-ci): catch destructured join() bin-spawns + browse server tests

Round 5 of windows-free-tests fixes. Round 4 caught Playwright launchers
but two more failure shapes appeared in shard 5:

1. test/diff-scope.test.ts uses `import { join }` (destructured) and
   `join(import.meta.dir, '..', 'bin', 'gstack-diff-scope')`. My round-3
   pattern only matched `path.join(...)` — the destructured form slipped
   through. Tightened the pattern to match the literal `, 'bin', '<name>'`
   path-segment shape regardless of whether it's `path.join` or `join`
   directly.

2. browse/test/sidebar-integration.test.ts spawns the browse server via
   `spawn(['bun', 'run', server.ts])` with BROWSE_HEADLESS_SKIP=1. The
   Bun-run-server.ts path is the same Playwright-on-Windows broken path
   that the windows-free-tests job intentionally avoids — the server-node.mjs
   route only kicks in for the compiled binary, not direct Bun runs of the
   TypeScript source. Added a BROWSE_HEADLESS_SKIP / spawn-bun-run pattern.

Curated Windows subset: 72 → 73 tests (~57% of free suite). Net up by 1
because the tightened bin pattern released one test that was a false
positive in the loose `path\\.join` form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-04-28 00:05:06 -07:00
parent 89d0e2be9b
commit f4e33bcbdb
+11 -2
View File
@@ -66,14 +66,23 @@ const WINDOWS_FRAGILE_PATTERNS: Array<{ pattern: RegExp; reason: string }> = [
// Tests that spawn a bash shebang script in bin/ via spawnSync. Git Bash on
// Windows can run `bash /path/to/script` but spawnSync(scriptPath, ...)
// tries to execute the file directly via CreateProcess, which fails on the
// shebang. Catches gstack-question-log.test.ts, gstack-paths.test.ts, etc.
{ pattern: /path\.join\([^)]*,\s*['"]bin['"]\s*[,)]/, reason: 'spawns bin/ shebang script (Windows CreateProcess does not parse shebangs)' },
// shebang. The pattern matches any path-join with a 'bin' segment as a
// separator-bounded literal. Catches both `path.join(ROOT, 'bin', ...)` and
// the destructured `join(import.meta.dir, '..', 'bin', ...)` form used in
// diff-scope.test.ts.
{ pattern: /,\s*['"]bin['"]\s*,\s*['"][a-z][\w-]+/, reason: 'spawns bin/ shebang script (Windows CreateProcess does not parse shebangs)' },
// Tests that launch a real Playwright browser. The windows-free-tests CI job
// runs a curated subset that intentionally does NOT install Chromium —
// browser bring-up on Windows is a separate concern (see PR #1238). Tests
// matching `await foo.launch(` need Chromium and fail with "Executable
// doesn't exist" on the runner.
{ pattern: /await\s+\w+\.launch\(/, reason: 'launches Playwright browser (Chromium not installed in windows-free CI)' },
// Tests that spawn the browse server as a subprocess via `bun run server.ts`.
// The Bun → server.ts → Playwright path is the same one that doesn't work
// on Windows (PR #1238 windows-pty-bun-pty-fix). Tests typically set
// BROWSE_HEADLESS_SKIP=1 to skip the browser launch but still need a working
// server, which they don't get on Windows.
{ pattern: /BROWSE_HEADLESS_SKIP|spawn\(\[['"]bun['"],\s*['"]run['"]/, reason: 'spawns the browse server subprocess (Bun-driven path is Windows-broken)' },
];
export const DEFAULT_SHARD_COUNT = 20;