e2e 0.21.1 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/.build.json +1 -1
- package/dist/agent/act-validation.js +1 -0
- package/dist/agent/act.js +7 -3
- package/dist/agent/action-dispatcher.js +30 -8
- package/dist/agent/actions.d.ts +2 -0
- package/dist/agent/actions.js +5 -2
- package/dist/agent/error.js +1 -0
- package/dist/agent/executor.d.ts +14 -6
- package/dist/agent/index.js +5 -1
- package/dist/agent/invocation.d.ts +3 -0
- package/dist/agent/model/sdk.d.ts +5 -0
- package/dist/agent/model/sdk.js +18 -1
- package/dist/agent/observation.js +1 -0
- package/dist/agent/primitives.js +14 -3
- package/dist/agent/replay.js +9 -3
- package/dist/agent/step-cache.d.ts +3 -2
- package/dist/agent/step-cache.js +7 -4
- package/dist/agent/tool-loop.js +4 -1
- package/dist/cache/context.js +1 -1
- package/dist/cache/recorder.d.ts +2 -1
- package/dist/cache/recorder.js +11 -2
- package/dist/cache/trace-fields.d.ts +10 -0
- package/dist/cache/trace-fields.js +17 -0
- package/dist/cache/trace.d.ts +9 -1
- package/dist/cache/trace.js +26 -7
- package/dist/cli/feedback.js +2 -1
- package/dist/cli/init/sibling-versions.json +1 -1
- package/dist/collect/select.js +12 -2
- package/dist/config/agent.d.ts +1 -1
- package/dist/config/diagnose.js +9 -3
- package/dist/config/esm-hooks.js +3 -2
- package/dist/config/resolve.js +3 -2
- package/dist/config/typescript.js +52 -2
- package/dist/engine/contract.d.ts +3 -2
- package/dist/engine/manifest.js +2 -2
- package/dist/internal/errors.js +5 -2
- package/dist/internal/source.js +2 -0
- package/dist/internal/unserved-model.d.ts +5 -0
- package/dist/internal/unserved-model.js +22 -0
- package/dist/locator/screen.js +1 -2
- package/dist/oauth/copilot.js +23 -5
- package/dist/oauth/device-code.js +35 -19
- package/dist/oauth/errors.d.ts +3 -0
- package/dist/oauth/errors.js +26 -11
- package/dist/oauth/providers/github-copilot.d.ts +4 -0
- package/dist/oauth/providers/github-copilot.js +64 -16
- package/dist/oauth/providers/openai.d.ts +2 -2
- package/dist/oauth/providers/openai.js +47 -19
- package/dist/oauth/providers/opencode-console.js +36 -15
- package/dist/oauth/providers/xai.js +18 -9
- package/dist/oauth/token-endpoint.d.ts +15 -6
- package/dist/oauth/token-endpoint.js +18 -6
- package/dist/report/code-frame.js +9 -3
- package/dist/report/failure-text.d.ts +10 -2
- package/dist/report/failure-text.js +24 -8
- package/dist/report/list-model.d.ts +13 -0
- package/dist/report/list-steps.d.ts +6 -1
- package/dist/report/list-steps.js +29 -0
- package/dist/report/list.d.ts +1 -0
- package/dist/report/list.js +16 -7
- package/dist/report/live-window.js +2 -1
- package/dist/report/markdown.js +1 -1
- package/dist/run/fixtures.js +2 -0
- package/dist/run/host-trace.d.ts +3 -2
- package/dist/run/host-trace.js +2 -1
- package/dist/run/last-run.d.ts +9 -0
- package/dist/run/last-run.js +28 -0
- package/dist/run/open-session.d.ts +3 -1
- package/dist/run/open-session.js +1 -1
- package/dist/run/runner.js +6 -2
- package/dist/run/sessions.js +3 -3
- package/dist/run/standalone-attempt.d.ts +2 -1
- package/dist/run/standalone-attempt.js +3 -1
- package/dist/run/steps.d.ts +3 -1
- package/dist/run/units.d.ts +8 -0
- package/dist/run/units.js +14 -0
- package/dist/run/worker-models.d.ts +2 -0
- package/dist/run/worker-models.js +7 -0
- package/dist/types.d.ts +2 -2
- package/docs/authentication.mdx +26 -23
- package/docs/browser.mdx +7 -4
- package/docs/bug-bash.mdx +2 -2
- package/docs/cache.mdx +6 -1
- package/docs/ci/bitrise.mdx +1 -1
- package/docs/ci/codemagic.mdx +2 -2
- package/docs/ci/eas-workflows.mdx +1 -1
- package/docs/coding-agents.mdx +7 -35
- package/docs/debugging.mdx +24 -36
- package/docs/executors.mdx +1 -1
- package/docs/github.mdx +2 -1
- package/docs/integrations/eas.mdx +1 -1
- package/docs/integrations/index.mdx +6 -0
- package/docs/integrations/lightpanda.mdx +192 -0
- package/docs/integrations/testmu.mdx +152 -0
- package/docs/mcp.mdx +123 -0
- package/docs/migrate/detox.mdx +1 -1
- package/docs/migrate/maestro.mdx +101 -105
- package/docs/migrate/playwright.mdx +65 -70
- package/docs/mobile.mdx +18 -3
- package/docs/models.mdx +4 -2
- package/docs/quickstart.mdx +7 -0
- package/docs/reference/agent.mdx +369 -277
- package/docs/reference/app.mdx +141 -32
- package/docs/reference/cli.mdx +674 -558
- package/docs/reference/config.mdx +1406 -752
- package/docs/reference/engine.mdx +1062 -256
- package/docs/reference/environment.mdx +156 -84
- package/docs/reference/errors.mdx +106 -72
- package/docs/reference/expect.mdx +752 -372
- package/docs/reference/mcp.mdx +366 -141
- package/docs/reference/mobile.mdx +844 -403
- package/docs/reference/reporters.mdx +312 -106
- package/docs/reference/runner.mdx +373 -174
- package/docs/reference/screen.mdx +931 -398
- package/docs/reference/security.mdx +106 -40
- package/docs/reference/test.mdx +626 -273
- package/docs/reference/web.mdx +956 -533
- package/docs/security.mdx +6 -5
- package/docs/snippets/model-provider.jsx +763 -0
- package/docs/snippets/setup-prompt-card.jsx +22 -0
- package/docs/snippets/show-more.jsx +22 -0
- package/docs/snippets/video-card.jsx +34 -0
- package/docs/snippets/video.jsx +25 -0
- package/docs/subscriptions.mdx +10 -3
- package/docs/telemetry.mdx +39 -39
- package/package.json +3 -2
- package/schema/report-v1.schema.json +6 -0
- package/skills/e2e/references/agent.md +8 -3
- package/skills/e2e/references/debugging.md +1 -1
- package/skills/e2e/references/mcp.md +1 -1
- package/skills/e2e/references/setup.md +12 -3
- package/skills/e2e/references/writing-tests.md +1 -1
|
@@ -6,11 +6,136 @@ icon: "file-lines"
|
|
|
6
6
|
"twitter:image": "https://e2e.tester.army/docs/images/og/reference/reporters.png?v=6f74d2a2a5"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
A reporter receives the run's events as they happen and the finished run
|
|
10
|
+
once its report is written. `reporters` in `e2e.config.ts` lists built-in
|
|
11
|
+
reporters by id beside reporter objects.
|
|
12
|
+
|
|
13
|
+
```ts title="e2e.config.ts"
|
|
14
|
+
import type { E2EConfig } from 'e2e';
|
|
15
|
+
import { web } from '@e2e-dev/web';
|
|
16
|
+
import { github } from '@e2e-dev/github';
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
targets: [{ engine: web(), app: { url: 'http://localhost:3000' } }],
|
|
20
|
+
reporters: ['list', 'junit', github()],
|
|
21
|
+
} satisfies E2EConfig;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Reference
|
|
25
|
+
|
|
26
|
+
### Built-in reporters
|
|
27
|
+
|
|
28
|
+
| Reporter | Description |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| [`list`](#list) | Terminal progress and run summary |
|
|
31
|
+
| [`json`](#json) | Report document to stdout |
|
|
32
|
+
| [`junit`](#junit) | Writes `<output>/junit.xml` |
|
|
33
|
+
| [`markdown`](#markdown) | Writes `<output>/summary.md` |
|
|
34
|
+
| [`github()`](#github) | Pull request comment and job summary |
|
|
35
|
+
|
|
36
|
+
| Throws | When |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `INVALID_CONFIG` | `reporters` is not an array. |
|
|
39
|
+
| `INVALID_CONFIG` | An id other than `list`, `json`, `junit`, or `markdown`. |
|
|
40
|
+
| `INVALID_CONFIG` | An entry that is neither an id nor an object with a `name` and at least one handler. |
|
|
41
|
+
| `INVALID_CONFIG` | `json` together with `list`. |
|
|
42
|
+
|
|
43
|
+
#### `list`
|
|
44
|
+
|
|
45
|
+
Renders terminal progress, failures, and the run summary.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
reporters: ['list'], // default
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- It renders the same events [`onEvent`](#onevent) receives.
|
|
52
|
+
- The [summary rows](#onrunfinished) reporters return print under its
|
|
53
|
+
summary.
|
|
54
|
+
|
|
55
|
+
#### `json`
|
|
56
|
+
|
|
57
|
+
Prints the report document to stdout.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
reporters: ['json'],
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### `junit`
|
|
64
|
+
|
|
65
|
+
Writes `junit.xml` beside the report.
|
|
12
66
|
|
|
13
67
|
```ts
|
|
68
|
+
reporters: ['list', 'junit'],
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- It reads `run.report`, writes `junit.xml` beside `run.reportPath`, and
|
|
72
|
+
returns one row naming the file. It is the smallest complete example of a
|
|
73
|
+
reporter.
|
|
74
|
+
- A second Ctrl-C still lets it write its file, so no file from the previous
|
|
75
|
+
run is left beside the new report.
|
|
76
|
+
|
|
77
|
+
#### `markdown`
|
|
78
|
+
|
|
79
|
+
Writes `summary.md` beside the report.
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
reporters: ['list', 'markdown'],
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
It does what `junit` does, second Ctrl-C included, with `summary.md` and
|
|
86
|
+
through [`renderMarkdownReport`](#rendermarkdownreport).
|
|
87
|
+
|
|
88
|
+
<a id="rendermarkdownreport" />
|
|
89
|
+
|
|
90
|
+
##### `renderMarkdownReport`
|
|
91
|
+
|
|
92
|
+
Renders a report as the Markdown page the `markdown` reporter writes, so
|
|
93
|
+
your own reporter can post the same page elsewhere.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { renderMarkdownReport, type Reporter } from 'e2e';
|
|
97
|
+
|
|
98
|
+
const reporter: Reporter = {
|
|
99
|
+
name: 'wiki',
|
|
100
|
+
async onRunFinished(run) {
|
|
101
|
+
const page = renderMarkdownReport(run.report, { traces: run.traces });
|
|
102
|
+
await fetch('https://wiki.example.test/runs', { method: 'POST', body: page });
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- `traces` links each block to its trace page by result id.
|
|
108
|
+
- [`@e2e-dev/github`](/github) is that reporter for GitHub Actions.
|
|
109
|
+
|
|
110
|
+
#### `github()`
|
|
111
|
+
|
|
112
|
+
`@e2e-dev/github` posts the run as one pull request comment from GitHub
|
|
113
|
+
Actions, keeps it current on reruns, and writes the same text to the job
|
|
114
|
+
summary.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { github } from '@e2e-dev/github';
|
|
118
|
+
|
|
119
|
+
const reporter = github({ key: 'chromium' });
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- `key` tells one job's comment apart from another's when the workflow, job,
|
|
123
|
+
and project are the same, as in a matrix. Without it, matrix replicas of
|
|
124
|
+
one job share a comment, and the last one to finish wins. Never use the
|
|
125
|
+
run id: a rerun must find the old comment. The key also names the comment
|
|
126
|
+
in its headline: `e2e chromium: 77 passed`.
|
|
127
|
+
- It reads the token, the event, and the repository when the run finishes,
|
|
128
|
+
never when the config loads.
|
|
129
|
+
- With `--last-failed`, it folds the rerun into [`lastRun`](#onrunfinished)
|
|
130
|
+
to show both runs as one comment.
|
|
131
|
+
- Setup and permissions are on [Pull request comments](/github).
|
|
132
|
+
|
|
133
|
+
### Custom reporters
|
|
134
|
+
|
|
135
|
+
A reporter object has a `name` and at least one handler. Use `onEvent` for
|
|
136
|
+
live progress and `onRunFinished` to process the final report and artifacts.
|
|
137
|
+
|
|
138
|
+
```ts title="e2e.config.ts"
|
|
14
139
|
import type { E2EConfig, Reporter } from 'e2e';
|
|
15
140
|
import { web } from '@e2e-dev/web';
|
|
16
141
|
|
|
@@ -32,7 +157,11 @@ export default {
|
|
|
32
157
|
} satisfies E2EConfig;
|
|
33
158
|
```
|
|
34
159
|
|
|
35
|
-
|
|
160
|
+
| Member | Type |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| [`name`](#name) | `string` |
|
|
163
|
+
| [`onEvent`](#onevent) | `(event: RunEvent) => void` |
|
|
164
|
+
| [`onRunFinished`](#onrunfinished) | `(run, signal) => Promise<…>` |
|
|
36
165
|
|
|
37
166
|
```ts
|
|
38
167
|
interface Reporter {
|
|
@@ -40,7 +169,59 @@ interface Reporter {
|
|
|
40
169
|
onEvent?(event: RunEvent): void;
|
|
41
170
|
onRunFinished?(run: FinishedRun, signal: AbortSignal): Promise<ReporterSummary | void>;
|
|
42
171
|
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Cached steps expose `cache.recordedBy: { provider, model }` in `report.json`
|
|
175
|
+
and on the trace page when the recording has it. Older recordings omit it.
|
|
176
|
+
The console prints `replayed · recorded with provider/model` only when that
|
|
177
|
+
identity differs from the configured model. It stays quiet for multi-agent
|
|
178
|
+
runs and for pinned agents whose model is not in the run header.
|
|
179
|
+
|
|
180
|
+
#### `name`
|
|
43
181
|
|
|
182
|
+
The reporter's label in diagnostics. Required and non-empty.
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
name: 'upload',
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### `onEvent`
|
|
189
|
+
|
|
190
|
+
Receives every run event as it happens, as plain JSON.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
onEvent(event) {
|
|
194
|
+
switch (event.type) {
|
|
195
|
+
case 'test-finished':
|
|
196
|
+
console.log(event.result.test.title, event.result.status);
|
|
197
|
+
break;
|
|
198
|
+
default:
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
[Events](#events) lists them.
|
|
204
|
+
|
|
205
|
+
<Note>
|
|
206
|
+
`onEvent` must not block and must not throw. Do slow work in
|
|
207
|
+
`onRunFinished`. A throw quarantines the reporter for the rest of the run and
|
|
208
|
+
prints one line on stderr naming the reporter, the event type, and the error.
|
|
209
|
+
The run's outcome is unchanged.
|
|
210
|
+
</Note>
|
|
211
|
+
|
|
212
|
+
#### `onRunFinished`
|
|
213
|
+
|
|
214
|
+
Runs once the report is written and the terminal summary prints, with the
|
|
215
|
+
finished run and an `AbortSignal`.
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
async onRunFinished(run, signal) {
|
|
219
|
+
await fetch('https://example.test/runs', { method: 'POST', body: JSON.stringify(run.report), signal });
|
|
220
|
+
return [{ label: 'Results', text: 'https://example.test/runs/0192c' }];
|
|
221
|
+
},
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```ts
|
|
44
225
|
interface FinishedRun {
|
|
45
226
|
readonly report: Report; // the report-1 document, as written
|
|
46
227
|
readonly status: RunStatus; // report.run.status
|
|
@@ -56,26 +237,61 @@ interface FinishedRun {
|
|
|
56
237
|
type ReporterSummary = readonly { label: string; text: string }[];
|
|
57
238
|
```
|
|
58
239
|
|
|
59
|
-
|
|
60
|
-
|
|
240
|
+
- All reporters run concurrently, each with a one-minute deadline.
|
|
241
|
+
- A timeout, exception, or invalid return value is reported on stderr. The
|
|
242
|
+
run's status, exit code, and report do not change.
|
|
243
|
+
- One Ctrl-C still lets reporters finish. A second Ctrl-C stops waiting for
|
|
244
|
+
them, except [`junit`](#junit) and [`markdown`](#markdown).
|
|
245
|
+
- `signal` aborts when the budget runs out or the run is forced to stop.
|
|
246
|
+
- The runner writes the trace pages, `results/<test>/trace.md`, before it
|
|
247
|
+
calls `onRunFinished`.
|
|
248
|
+
|
|
249
|
+
<Note>
|
|
250
|
+
Hand `signal` to every request and timer, or an abandoned reporter keeps the
|
|
251
|
+
CLI alive after the run has ended.
|
|
252
|
+
</Note>
|
|
253
|
+
|
|
254
|
+
##### Summary rows
|
|
255
|
+
|
|
256
|
+
The rows a reporter resolves with print under the `list` summary, in the
|
|
257
|
+
same layout as its own rows. The `json` reporter does not carry them.
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
Test Files 2 passed (2)
|
|
261
|
+
Tests 6 passed (6)
|
|
262
|
+
Start at 14:02:11
|
|
263
|
+
Duration 8.41s
|
|
61
264
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
page by result id. The runner writes the trace pages, `results/<test>/trace.md`, before
|
|
68
|
-
`onRunFinished` is called. [`@e2e-dev/github`](/github) is that
|
|
69
|
-
reporter for GitHub Actions.
|
|
265
|
+
JUnit .e2e/junit.xml
|
|
266
|
+
Results https://example.test/runs/0192c…
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
##### Artifacts
|
|
70
270
|
|
|
71
|
-
|
|
72
|
-
`
|
|
271
|
+
- Artifact paths in the report are POSIX paths relative to `artifactsRoot`.
|
|
272
|
+
- `path`, `size`, and `sha256` are optional: an artifact whose file never
|
|
273
|
+
appeared, or that a redaction withheld, is recorded without them. Check for
|
|
274
|
+
`path` before reading.
|
|
275
|
+
- A video a hosted service keeps has an `http(s)` `url` in place of `path`.
|
|
73
276
|
|
|
74
|
-
|
|
277
|
+
##### Reruns with `--last-failed`
|
|
75
278
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`
|
|
279
|
+
- The rerun's own report lists the tests it left out as unselected. A
|
|
280
|
+
reporter that keeps one place current, the way `@e2e-dev/github` keeps a
|
|
281
|
+
pull request comment, folds the rerun into `lastRun` to show both runs as
|
|
282
|
+
one.
|
|
283
|
+
- A test the rerun owed but another filter left out is in the rerun's
|
|
284
|
+
`run.carried`. It holds the test's last result, the serial group its
|
|
285
|
+
attempts live on, and the `beforeAll` or `afterAll` failure whose scope
|
|
286
|
+
holds it, from whichever earlier run reported them.
|
|
287
|
+
- A fold shows the carried result in place of the unselected one and counts
|
|
288
|
+
a carried failure or hook error against the outcome.
|
|
289
|
+
- The artifacts both reports name are on disk under `artifactsRoot`.
|
|
290
|
+
|
|
291
|
+
## Events
|
|
292
|
+
|
|
293
|
+
`onEvent` receives one of these facts. Each event also has a sequence
|
|
294
|
+
number, `seq`, and an ISO timestamp, `at`.
|
|
79
295
|
|
|
80
296
|
```ts
|
|
81
297
|
type RunEventFact =
|
|
@@ -96,17 +312,43 @@ type RunEventFact =
|
|
|
96
312
|
| { type: 'run-finished'; status; exitCode; reportPath?; aiTracePath?; traces? };
|
|
97
313
|
```
|
|
98
314
|
|
|
99
|
-
`
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
315
|
+
- `run-started` comes first and `run-finished` last.
|
|
316
|
+
- `judge` on `run-started` is the run agent's judge model, present only when
|
|
317
|
+
judgments use a model other than `model`.
|
|
318
|
+
- `output` is one write a test made to stdout or stderr; `pair` names the
|
|
319
|
+
test running at the time and is undefined between tests.
|
|
320
|
+
- `test-finished` carries the full result record, including every attempt's
|
|
321
|
+
artifacts.
|
|
322
|
+
- `explore` appears only in an `e2e explore` run: `started`, `planning`,
|
|
323
|
+
`step-started`, `step-finished`, `finding`, and `finished`. The record of
|
|
324
|
+
all of it is `run.explore` in the report.
|
|
325
|
+
- New event types are added over time. Handle the types you know and ignore
|
|
326
|
+
the rest; leave the `default` branch of a `switch` empty.
|
|
327
|
+
|
|
328
|
+
### Tests and attempts
|
|
329
|
+
|
|
330
|
+
- A test pinned to several agents starts and finishes once per agent, so key
|
|
331
|
+
running state by test id, target, and agent together.
|
|
332
|
+
- Ordinary tests emit `test-started` once for that combination. Serial
|
|
333
|
+
members emit it on each group attempt they execute.
|
|
334
|
+
- Use step progress [identity](#step-progress) to distinguish retries.
|
|
335
|
+
- An attempt that fails before any step emits no step progress and appears
|
|
336
|
+
in the final result.
|
|
337
|
+
|
|
338
|
+
<Note>
|
|
339
|
+
Secrets are redacted before events are built. Error messages are only
|
|
340
|
+
stripped of control characters, so treat them as untrusted.
|
|
341
|
+
</Note>
|
|
342
|
+
|
|
343
|
+
### Step progress
|
|
103
344
|
|
|
104
345
|
The `phase` field describes step progress:
|
|
105
346
|
|
|
106
347
|
- `start` and `end` mark the step's boundaries.
|
|
107
348
|
- `event` reports a completed model turn, tool call, or observation.
|
|
108
349
|
- `activity` reports work starting: `observe`, `action`, or `model`.
|
|
109
|
-
- `replay` reports when replay from the cache starts or returns control to
|
|
350
|
+
- `replay` reports when replay from the cache starts or returns control to
|
|
351
|
+
the agent.
|
|
110
352
|
|
|
111
353
|
```ts
|
|
112
354
|
type StepProgress = (
|
|
@@ -128,98 +370,62 @@ type StepProgress = (
|
|
|
128
370
|
) & { identity?: StepProgressIdentity };
|
|
129
371
|
```
|
|
130
372
|
|
|
131
|
-
|
|
373
|
+
An `end` phase's `error` and `explanation` are redacted. Keep its `status`,
|
|
374
|
+
including `blocked` and `cancelled`. Do not treat every non-passed step as a
|
|
375
|
+
product failure.
|
|
376
|
+
|
|
377
|
+
Every step phase the runner emits includes `progress.identity`:
|
|
132
378
|
|
|
133
379
|
```ts
|
|
134
380
|
{ attemptId: string; attemptIndex: number; stepId: string; stepIndex: number }
|
|
135
381
|
```
|
|
136
382
|
|
|
137
|
-
The IDs match the final report. Both indexes start at zero.
|
|
138
|
-
new attempt ID and a higher attempt index; its step indexes
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
instead of treating every non-passed step as a product failure.
|
|
147
|
-
|
|
148
|
-
`explore` appears only in an `e2e explore` run: `started`, `planning`,
|
|
149
|
-
`step-started`, `step-finished`, `finding`, and `finished`. The record of all
|
|
150
|
-
of it is `run.explore` in the report.
|
|
151
|
-
|
|
152
|
-
New event types are added over time. Handle the types you know and ignore
|
|
153
|
-
the rest; leave the `default` branch of a `switch` empty.
|
|
154
|
-
|
|
155
|
-
`run-started` comes first and `run-finished` last. `test-finished` carries the
|
|
156
|
-
full result record, including every attempt's artifacts. A test pinned to
|
|
157
|
-
several agents starts and finishes once per agent, so key running state by
|
|
158
|
-
test id, target, and agent together. Ordinary tests emit `test-started` once
|
|
159
|
-
for that combination. Serial members emit it on each group attempt they
|
|
160
|
-
execute. Use step progress identity to distinguish retries. An attempt
|
|
161
|
-
that fails before any step emits no step progress and appears in the final
|
|
162
|
-
result. Secrets are redacted before events are
|
|
163
|
-
built. Error messages are only stripped of control characters; treat them as
|
|
164
|
-
untrusted.
|
|
165
|
-
|
|
166
|
-
`onEvent` must not block and must not throw. A throw quarantines the reporter
|
|
167
|
-
for the rest of the run and prints one line on stderr naming the reporter, the
|
|
168
|
-
event type, and the error; the run's outcome is unchanged. Slow work belongs
|
|
169
|
-
in `onRunFinished`.
|
|
170
|
-
|
|
171
|
-
## The finished run
|
|
172
|
-
|
|
173
|
-
`onRunFinished` runs after the report is written and the terminal summary
|
|
174
|
-
prints. All reporters run concurrently, each with a one-minute deadline.
|
|
175
|
-
A timeout, exception, or invalid return value is reported on stderr without
|
|
176
|
-
changing the run's status, exit code, or report.
|
|
177
|
-
|
|
178
|
-
One Ctrl-C still lets reporters finish. A second Ctrl-C stops waiting for them, except the built-in `junit` and `markdown`, which still write their files so none of the previous run's is left beside the new report.
|
|
179
|
-
|
|
180
|
-
The second argument is an `AbortSignal` that aborts when the budget runs out
|
|
181
|
-
or the run is forced to stop. Hand it to every request and timer, or an
|
|
182
|
-
abandoned reporter keeps the CLI alive after the run has ended.
|
|
183
|
-
|
|
184
|
-
With `--last-failed`, `lastRun` is the report the rerun selected from. The
|
|
185
|
-
rerun's own report lists the tests it left out as unselected, so a reporter
|
|
186
|
-
that keeps one place current, the way `@e2e-dev/github` keeps a pull request
|
|
187
|
-
comment, folds the rerun into `lastRun` to show both runs as one. A test the
|
|
188
|
-
rerun owed but another filter left out is in the rerun's `run.carried`: its
|
|
189
|
-
last result, the serial group its attempts live on, and the `beforeAll` or
|
|
190
|
-
`afterAll` failure whose scope holds it, from whichever earlier run reported
|
|
191
|
-
them. A fold shows the carried result in place of the unselected one and
|
|
192
|
-
counts a carried failure or hook error against the outcome. The artifacts
|
|
193
|
-
both reports name are on disk under `artifactsRoot`.
|
|
194
|
-
|
|
195
|
-
The rows a reporter resolves with print under the `list` summary in the same
|
|
196
|
-
layout as its own rows; the `json` reporter does not carry them:
|
|
383
|
+
- The IDs match the final report. Both indexes start at zero.
|
|
384
|
+
- A retry has a new attempt ID and a higher attempt index; its step indexes
|
|
385
|
+
start again at zero.
|
|
386
|
+
- Serial-group members share the group's attempt ID and index. Each
|
|
387
|
+
member's step IDs stay distinct.
|
|
388
|
+
- Use `stepId` to match start, activity, event, replay, and end phases,
|
|
389
|
+
including nested steps.
|
|
390
|
+
- `identity` is optional in the type so a reporter can also accept older
|
|
391
|
+
streams.
|
|
197
392
|
|
|
198
|
-
|
|
199
|
-
Test Files 2 passed (2)
|
|
200
|
-
Tests 6 passed (6)
|
|
201
|
-
Start at 14:02:11
|
|
202
|
-
Duration 8.41s
|
|
393
|
+
## What `--reporter` does to reporter objects
|
|
203
394
|
|
|
204
|
-
|
|
205
|
-
|
|
395
|
+
`--reporter` replaces only the built-in reporters; configured reporter
|
|
396
|
+
objects still run.
|
|
397
|
+
|
|
398
|
+
<CodeGroup>
|
|
399
|
+
```bash npm
|
|
400
|
+
npx e2e run --reporter list,junit
|
|
206
401
|
```
|
|
207
402
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`path` before reading. A video a hosted service keeps has an `http(s)` `url`
|
|
212
|
-
in place of `path`.
|
|
403
|
+
```bash pnpm
|
|
404
|
+
pnpm exec e2e run --reporter list,junit
|
|
405
|
+
```
|
|
213
406
|
|
|
214
|
-
|
|
407
|
+
```bash bun
|
|
408
|
+
bunx e2e run --reporter list,junit
|
|
409
|
+
```
|
|
410
|
+
</CodeGroup>
|
|
215
411
|
|
|
216
|
-
|
|
217
|
-
objects still run. A config with only reporter objects has no built-in
|
|
218
|
-
terminal output.
|
|
412
|
+
- A config with only reporter objects has no built-in terminal output.
|
|
219
413
|
|
|
220
414
|
## Where a reporter runs
|
|
221
415
|
|
|
222
|
-
Handlers run in the runner process. Workers also load the config, so
|
|
223
|
-
construction must have no side effects.
|
|
224
|
-
|
|
225
|
-
|
|
416
|
+
Handlers run in the runner process. Workers also load the config, so
|
|
417
|
+
reporter construction must have no side effects.
|
|
418
|
+
|
|
419
|
+
- Read tokens and start requests inside handlers.
|
|
420
|
+
- Adding a reporter leaves [cached traces](/cache#what-must-match) valid.
|
|
421
|
+
|
|
422
|
+
## Types
|
|
423
|
+
|
|
424
|
+
`Reporter`, `FinishedRun`, `ReporterSummary`, `Report`, `RunEvent`, and
|
|
425
|
+
`RunEventOf` are exported from the main entrypoint, and so is
|
|
426
|
+
`renderMarkdownReport(report, options)`.
|
|
427
|
+
|
|
428
|
+
## Related
|
|
429
|
+
|
|
430
|
+
[Pull request comments](/github) sets up `@e2e-dev/github`. The
|
|
431
|
+
[CLI reference](/reference/cli#output) lists what the built-in reporters write.
|