Repository navigation
fix(pregate): run Playwright specs with playwright test, not the unit runner - #3629
nfitzsimmons wants to merge 1 commit into
Conversation
… runner In a repo whose unit runner is vitest (or jest, or bun), the lanes check sent every changed JS/TS test to that runner, Playwright specs included. Vitest's include filter matches none of them, so a diff that touches only Playwright specs ran `npx vitest run tests/e2e/...`, printed "No test files found" and failed the lane with exit 1. A diff that also selected unit tests hid it. A JS/TS test that imports @playwright/test now plans its own group, run as `playwright test` from its nearest package through that package's manager (npx, pnpm exec, yarn, bun x). A declared runner still takes every file. parseSummary reads Playwright's count lines (failed tests are listed between them, so the generic `N failed, N passed` match missed the failures). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thank you for this fix. A crew lane is picking it up, together with your related pregate PRs, to land on current main with Co-authored-by credit to you. |
…s; literals stops flagging stray digits (#3598, #3492) (#3741) * fix(pregate): runner detection for pytest, Playwright and mixed-language roots; literals binds one-character values A missing pytest is PREGATE_ENVIRONMENT, not the diff's failure (#3598). Playwright specs run under playwright test, with missing browsers reported as the machine's gap (#3629). Root tests in two languages each get their runner, and a repo's bun/vitest/jest claims only JS/TS (#3600). literals counts a one-character old value only in a statement naming the constant, and a call-site name also needs the module (#3492, gstack-evals#97). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: pre-landing review fixes Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(pregate): name the import-type shapes the Playwright detection skips Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix: escape Playwright file filters; skip type-only Playwright imports; pytest probe and summary read hardening Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(pregate): linear Playwright import scan; comments and no-space imports detected Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(pregate): Playwright missing-browsers exception and literals continuation rule Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
Thanks @nfitzsimmons. This landed in v1.93.15.0 as #3741: a spec that imports |
Summary
In a repo that has Vitest unit tests and Playwright specs,
gstack-pregatesends every changed JS/TS test file to the one detected runner.detectRunnerreturnsnpx vitest run {files}as soon asvitestis a dependency, so a diff that touches only Playwright specs runs:Vitest's
includefilter matches none of the specs, so the lane fails even though the specs pass. A diff that also selects a unit test hides the bug, because Vitest then runs those files and drops the specs without a word. So most of the time the specs are skipped and nothing says so. When a diff touches only specs,/shipcan't publish a pregate record.With this change, a JS/TS test that imports
@playwright/testgets its own group, run asplaywright testfrom its nearest package, through the same package manager the nested-package runner uses (npx,pnpm exec,yarn,bun x). Other tests keep their runner. A declaredrunnerstill takes every file. A package manager missing from PATH leaves the spec unclaimed and names it, the same as the nested vitest path.parseSummaryalso learns Playwright's summary. Playwright printsN failed, then the failed test names, thenN passed, so the generic(N failed,)? N passedmatch counted every failure as zero. The parser now reads each count line on its own (failed, flaky, passed; skipped did not run), and only when the runner isplaywright test.Blast radius
The routing is in
planRuns, and the summary parser runs only when the runner string containsplaywright test. A repo with no test importing@playwright/testgets the same plan as before, and a declaredrunnerskips the new branch entirely. The existing negative controls and nested-package tests still pass.Tests
planRunscase intest/pregate-selection.test.ts. The root has vitest; there is a root spec, a nested pnpm package with a vitest test, and a nested spec. Specs go tonpx playwright testandpnpm exec playwright test, while the unit tests keepnpx vitest runandpnpm exec vitest run. Also covered: a declared runner still takes the spec, and a missing pnpm leaves it unclaimed.parseSummarygets two rows: a failed, flaky, skipped and passed run with names between the counts (ran: 138, failed: 2), and a clean run.bun run typecheckis clean, andbun run typecheck:testreports no new diagnostics.test/pregate-{selection,rust,dart,bats-nested,supervise}.test.ts: 87 pass, 8 fail. The same 8 fail on main without this change on my Mac (supervise progress adapters, the hang/timeout bin cases, and fourgstack-pregate (bin)cases), so they look environment-dependent.npx playwright teston the three specs and passes:121 tests ran in 3 file(s), exit 0.Not covered: the planner doesn't build the app, so a Playwright project that needs a build before its specs, and has no
webServer, still tests whatever build is on disk. Repos like that can declare aguardsentry for their e2e script, as before.🤖 Generated with Claude Code