diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ed35f1679d..df7b76c871 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -442,7 +442,7 @@ jobs: specs="$(node ./scripts/e2e-shard.mjs \ --shard-index ${{ matrix.shard_index }} --shard-count ${{ matrix.shard_count }})" echo "shard ${{ matrix.shard_label }} specs: $specs" - pnpm run test:e2e -- $specs + pnpm run test:e2e $specs - name: Upload Playwright report uses: actions/upload-artifact@v7 diff --git a/scripts/__tests__/e2e-shard.test.mjs b/scripts/__tests__/e2e-shard.test.mjs index 3ec6fc829e..cdd3c7cd80 100644 --- a/scripts/__tests__/e2e-shard.test.mjs +++ b/scripts/__tests__/e2e-shard.test.mjs @@ -142,3 +142,18 @@ test("pr.yml keeps a stable aggregate check named e2e over the shard matrix", () assert.equal(entry.shardLabel, `${entry.shardIndex + 1}/${SHARD_COUNT}`, "each shard label must match its index"); } }); + +test("pr.yml passes the shard's spec filter to Playwright without a literal --", () => { + // `pnpm run test:e2e -- $specs` forwards the literal separator to Playwright, + // so the specs after it are not applied as file filters. + const workflow = readFileSync(prWorkflow, "utf8"); + assert.ok( + !/pnpm run test:e2e --\s/.test(workflow), + "pr.yml must not insert a literal `--` between `pnpm run test:e2e` and the spec filter", + ); + assert.match( + workflow, + /pnpm run test:e2e \$specs/, + "pr.yml e2e_shards must invoke `pnpm run test:e2e $specs`", + ); +});