fix(windows-ci): broaden bin/ pattern to match path.join(ROOT, 'bin')

Round 6. Round 5 tightened the bin/ pattern to require a script-name segment
after 'bin', which inadvertently released test/brain-sync.test.ts that uses:

  const BIN = path.join(ROOT, 'bin');
  const full = bin.startsWith('/') ? bin : path.join(BIN, bin);

The 'bin' segment is the LAST argument to path.join — there's no literal
script name to match. The earlier looser pattern caught this; round 5
broke that.

Fix: revert to `,\\s*['"]bin['"]\\s*[,)]` which matches both forms:
  - `, 'bin', 'script-name')`  (path.join with name) — typical
  - `, 'bin')`                  (path.join ending at bin) — brain-sync style

Curated subset: 73 → 66 tests (~52% of free suite). The 7 additional
exclusions are all bin-script tests that were misclassified by the round-5
tightening.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-04-28 00:07:22 -07:00
parent f4e33bcbdb
commit 9cc846d0fe
+6 -5
View File
@@ -66,11 +66,12 @@ 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. 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)' },
// shebang. The pattern matches `, 'bin'` as a path-join argument (closing
// OR followed by another segment), which catches:
// - path.join(ROOT, 'bin', 'script-name') — typical
// - join(import.meta.dir, '..', 'bin', 'name') — destructured (diff-scope)
// - path.join(ROOT, 'bin') — bare BIN constant (brain-sync)
{ pattern: /,\s*['"]bin['"]\s*[,)]/, 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