fix(test-runner): recover beforeAll-skipped tests for --last-failed - #42056
Merged
Pavel Feldman (pavelfeldman) merged 1 commit intoJul 30, 2026
Conversation
When an ancestor beforeAll hook fails, Playwright fails the first test in that group and marks the remaining tests as "did not run". Internally, those tests get outcome() === 'skipped' and ok() === true, identical to a test intentionally skipped via test.skip()/fixme(). .last-run.json's failedTests is computed as allTests().filter(t => !t.ok()), so these did-not-run tests were silently excluded, indistinguishable from intentional skips. On a CI rerun with --last-failed, only the ids in failedTests are re-executed, so these tests were dropped and became unreachable for the rest of that run. This adds a didNotRun() check mirroring the predicate already used in reporters/base.ts for the CLI's "N did not run" summary line, and includes those tests in failedTests. Interrupted runs (e.g. Ctrl+C) are explicitly excluded, since those tests were already in progress rather than skipped by a hook failure. References microsoft#33974
Pavel Feldman (pavelfeldman)
approved these changes
Jul 30, 2026
Contributor
Test results for "tests 1"5 flaky51068 passed, 1188 skipped Merge workflow run. |
Contributor
Test results for "MCP"3 failed 7812 passed, 1272 skipped Merge workflow run. |
Pavel Feldman (pavelfeldman)
merged commit Jul 30, 2026
0484712
into
microsoft:main
48 of 50 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When an ancestor
beforeAllhook fails, Playwright fails the first test in that group and marks the remaining tests as"did not run". Internally, those tests getoutcome() === 'skipped'andok() === true, exactly like a test intentionally skipped viatest.skip()/fixme()..last-run.json'sfailedTestsis computed asallTests().filter(t => !t.ok()), so these did-not-run tests are silently excluded, indistinguishable from intentional skips. When CI reruns with--last-failed, only the ids infailedTestsare re-executed so these tests are dropped and become unreachable for the rest of that run.Fix
Adds a
didNotRun()check inpackages/playwright/src/runner/lastRun.tsand includes those tests infailedTests. The predicate mirrors the one already used inreporters/base.tsfor the CLI's "N did not run" summary line:outcome() === 'skipped'and either no results yet orexpectedStatus !== 'skipped'. Interrupted runs (e.g. Ctrl+C) are explicitly excluded, since those tests were already in progress rather than skipped by a hook failure.Testing
Added two tests to
tests/playwright-test/runner.spec.ts:--last-failedtest.skip()still stays excluded from--last-failed