Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/rerun-integrity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"e2e": patch
"@e2e-dev/github": patch
---

`--last-failed` no longer goes green on tests it never ran. It reruns tests `--max-failures` skipped, and a test or failed `beforeAll`/`afterAll` another filter leaves out stays owed in the report's new `run.carried` until a rerun runs it. A rerun also keeps the artifacts of the run it reruns and writes its own under `artifacts/rerun-<n>/` in the output directory (`.e2e` by default), so the folded pull request comment keeps its evidence and stays red while anything is owed.
10 changes: 6 additions & 4 deletions docs/ci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ implemented yet.

`--last-failed` runs only the tests the previous run did not pass, read from
`report.json` in the [`output`](/reference/config#output) directory (`.e2e`
by default). The rerun empties `artifacts/` there when it starts, so
upload the first run's artifacts before rerunning in the same job if you want
both. The [CLI reference](/reference/cli#flags) lists what counts as not
passed. Locally it is the loop after a red run:
by default). The rerun keeps the artifacts the first run's report names and
writes its own under `artifacts/rerun-1/`, so one upload after both steps
holds the evidence of each. A test another filter keeps out of the rerun
stays owed: the next `--last-failed` runs it. The
[CLI reference](/reference/cli#flags) lists what counts as not passed.
Locally it is the loop after a red run:

<CodeGroup>
```bash npm
Expand Down
4 changes: 3 additions & 1 deletion docs/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ failed result:

Artifacts land under `.e2e/artifacts/` (`<output>/artifacts/` when the
[`output`](/reference/config#output) is moved), one directory per attempt.
Each run empties it first, so it holds the latest run's evidence:
Each run empties it first, so it holds the latest run's evidence. A
`--last-failed` rerun instead empties it down to the files the report it
reruns names, and writes its own under `rerun-<n>/`:

- **Screenshots.** Failed attempts capture one whenever the engine can and
pixels are allowed. The built-in `agent.assert` also captures one after
Expand Down
16 changes: 11 additions & 5 deletions docs/github.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ Upload artifacts even when a retry passes. Each failure's evidence links open
the run's Artifacts section; inside the download, every test has a directory
named after it and the agent that ran it
(`web/tests_billing.e2e.ts__upgrades/default/attempt-0/`), so keep
`path: .e2e/artifacts` and the download lines up with the report. A project
`path: .e2e/artifacts` and the download lines up with the report. A
`--last-failed` rerun keeps the first run's directories and puts its own
under `rerun-1/`, so a flaky test's failed attempt still links to its own
files. A project
below the checkout root, such as `packages/e2e-tests`, gets source links under
that path. The checkout root is the nearest directory holding `.git` inside
`GITHUB_WORKSPACE`, so `actions/checkout` with a `path` input works too.
Expand Down Expand Up @@ -144,10 +147,13 @@ passes:
The comment covers the whole suite, not only the tests the rerun ran again.
A test that failed and then passed shows as flaky, a test that failed twice
stays failed, one that was interrupted and then passed shows as passed, and
the rest keep their first-pass results. The comment
matches the job's status: it stays red when another filter kept a failed
test out of the rerun, and shows ⏹️ when it kept out a test the first pass
never finished.
the rest keep their first-pass results. The comment stays red while the
rerun left out something it owed: a failed test, one `--max-failures` stopped
before it ran, or a failed `beforeAll` or `afterAll` whose tests another
filter kept out of the rerun. It shows ⏹️ when the rerun left out a test the
first pass never finished. The rerun's own exit code counts only what it ran.
A failed attempt's evidence links to the first run's files, which the rerun
keeps.

## Matrix jobs

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ or every test was filtered out.
| `--exclude-tag <tags>` | comma-separated or repeated | none | Leaves out every test carrying any of the tags, whatever `--tag` or a positional selected. A serial group still runs whole when any member is selected; tag the serial `describe` to exclude the flow. |
| `--grep <pattern>` | regular expression, repeatable | none | Only tests whose title matches one of the patterns. The text matched is the describe titles and the test title joined by one space (`checkout pays`); the file and the tags are not part of it. A bare pattern is case-sensitive; `'/pattern/i'` adds flags. A pattern that does not compile is a usage error, exit 2. |
| `--grep-invert <pattern>` | regular expression, repeatable | none | Leaves out every test whose title matches one of the patterns. Same text and pattern forms as `--grep`; both together keep the tests `--grep` matches minus the ones `--grep-invert` matches. |
| `--last-failed` | boolean | `false` | Only the tests the previous run did not pass, read from the `report.json` this run overwrites, `<output>/report.json` (`--output`, else the config's [`output`](/reference/config#output)): failed, timed out, interrupted, or skipped because a setup, a serial predecessor, a hook, or the worker failed, and every test it selected in the describe or file, on that target, of a `beforeAll` or `afterAll` that failed (for a setup, the tests that consume its session). A rerun that runs the hook again reports it again if it still fails; another filter that leaves its tests out leaves the failure out of the next report too. A test is named per target and agent. No report is `NO_LAST_RUN`; a previous run with nothing failed selects nothing, `NO_TESTS` unless `--pass-with-no-tests`. |
| `--last-failed` | boolean | `false` | Only the tests the previous run did not pass, read from the `report.json` this run overwrites, `<output>/report.json` (`--output`, else the config's [`output`](/reference/config#output)): failed, timed out, interrupted, or skipped because a setup, a serial predecessor, a hook, or the worker failed or `--max-failures` stopped the run first, and every test it selected in the describe or file, on that target, of a `beforeAll` or `afterAll` that failed (for a setup, the tests that consume its session). A rerun that runs the hook again reports it again if it still fails, and a rerun that runs any test of its scope without it failing resolves it. A test another filter (`--grep`, `--tag`, `--target`, `--agent`, a positional) leaves out of the rerun stays owed: the rerun's report carries its last result, and the hook failure whose scope it is in, under `run.carried`, the next `--last-failed` selects it again, and the [`@e2e-dev/github`](/github) page stays red until it passes (⏹️ for a test the run before interrupted). The rerun's own exit code and summary count only what it ran. It keeps the artifacts the previous report names and writes its own under `artifacts/rerun-<n>/`, so no attempt overwrites an earlier one's files. A test is named per target and agent. No report is `NO_LAST_RUN`; a previous run with nothing failed selects nothing, `NO_TESTS` unless `--pass-with-no-tests`. |
| `--shard <index/total>` | `2/3` | none | Runs one contiguous slice of the selected tests, cut once every other filter applied. Slices differ in size by at most one test, a serial group counts as one and is never split, and each shard brings only the setup tests its own tests need. Every shard runs the same command with a different index; the order is the report order, so the same suite shards the same way on every machine. A shard that gets no test is `NO_TESTS` unless `--pass-with-no-tests`. See [Sharding](/ci#sharding). |
| `--headed` | boolean | `false` | Visible UI when the engine supports it. |
| `--agent <names>` | comma-separated or repeated | `default` | Runs unpinned tests once per selected agent. For a test with `{ agent }`, selects the shared names when there is overlap; otherwise keeps the test's selection. An unknown name is `INVALID_CONFIG`. |
Expand All @@ -368,7 +368,7 @@ or every test was filtered out.
| `--repeat-each <n>` | integer, at least 1 | `1` | Runs every selected test this many times. Each run is a result of its own, with `repeat` 0 through `n - 1` and its own `id`; the list reporter titles the later runs `(repeat #1)`, `(repeat #2)`, and their artifacts go under a `repeat-<n>` directory. Setup tests run once. With the replay cache on, the first run records and the later ones replay, so pair it with `--no-cache` to exercise the model each time. The `list` summary adds a `Repeats` row (`1 of 2 tests passed all 5 runs`) and one line per test that did not pass every run, naming each run that failed; the `markdown` page carries the same tally. |
| `--max-failures <n>` | integer, at least 1 | none | Stops the run once this many tests have failed or timed out. Nothing more is dispatched, the tests running on other workers end as `interrupted`, and the tests not started, the rest of the file whose test reached the limit included, are skipped with cause `failure-limit` and the reason `run stopped after 3 failures (--max-failures 3)`. The exit code is the failures' own, 1, not 130. |
| `--reporter <ids>` | comma-separated list | config | Replaces the built-in IDs in `config.reporters`: `list`, `json`, `junit`, `markdown`. `json` with `list` is `INVALID_CONFIG`. [Reporter objects](/reference/reporters) in the config keep running. |
| `--output <dir>` | string | config, else `.e2e` | The results directory for this run, over the config's [`output`](/reference/config#output): the report, the reporter files, the AI trace, `artifacts/` (cleared once the run's tests start), and `sessions/`. Resolved from the project root; one the run cannot own is `INVALID_CONFIG`. The removed `--artifacts <dir>` fails with the `--output` it maps to: `--artifacts out/artifacts` is `--output out`, and a directory whose parent is the project root or outside it maps to `--output .e2e`. |
| `--output <dir>` | string | config, else `.e2e` | The results directory for this run, over the config's [`output`](/reference/config#output): the report, the reporter files, the AI trace, `artifacts/` (cleared once the run's tests start, down to what the previous report names on a `--last-failed` rerun), and `sessions/`. Resolved from the project root; one the run cannot own is `INVALID_CONFIG`. The removed `--artifacts <dir>` fails with the `--output` it maps to: `--artifacts out/artifacts` is `--output out`, and a directory whose parent is the project root or outside it maps to `--output .e2e`. |
| `--no-cache` | boolean | `false` | Replay cache off for this run, whatever `config.cache` says. |
| `--strict-cache` | boolean | `false` | Turns on `cache.strict` for this run: a step whose recording exists but no longer replays fails with `REPLAY_STALE` instead of handing off to the agent. See [Fail on a stale recording](/cache#fail-on-a-stale-recording). |
| `--pass-with-no-tests` | boolean | `false` | Exit 0 instead of `NO_TESTS` when nothing is selected. |
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ run.
| `report.json` | The canonical report; `--last-failed` reads the one here |
| `junit.xml`, `summary.md`, `failures/` | The `junit` and `markdown` reporters' files |
| `ai-trace.json` | `--ai-trace` |
| `artifacts/` | Screenshots, traces, videos, downloads, and logs, one directory per attempt. Cleared once a run's tests start, so it holds the latest run's evidence and nothing its report no longer names |
| `artifacts/` | Screenshots, traces, videos, downloads, and logs, one directory per attempt. Cleared once a run's tests start, so it holds the latest run's evidence and nothing its report no longer names. A `--last-failed` rerun keeps the files the report it reruns names and writes its own attempts under `artifacts/rerun-<n>/` |
| `sessions/` | The run's encrypted `test.setup` sessions, deleted when it ends |
| `videos/<session>/` | [`e2e mcp`](/reference/mcp#recording) session recordings |

Expand Down
8 changes: 7 additions & 1 deletion docs/reference/reporters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@ abandoned reporter keeps the CLI alive after the run has ended.
With `--last-failed`, `lastRun` is the report the rerun selected from. The
rerun's own report lists the tests it left out as unselected, so a reporter
that keeps one place current, the way `@e2e-dev/github` keeps a pull request
comment, folds the rerun into `lastRun` to show both runs as one.
comment, folds the rerun into `lastRun` to show both runs as one. A test the
rerun owed but another filter left out is in the rerun's `run.carried`: its
last result, the serial group its attempts live on, and the `beforeAll` or
`afterAll` failure whose scope holds it, from whichever earlier run reported
them. A fold shows the carried result in place of the unselected one and
counts a carried failure or hook error against the outcome. The artifacts
both reports name are on disk under `artifactsRoot`.

The rows a reporter resolves with print under the `list` summary in the same
layout as `Report`; the `json` reporter does not carry them:
Expand Down
Loading
Loading