e2e 0.16.0 → 0.17.0

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.
Files changed (174) hide show
  1. package/dist/.build.json +1 -1
  2. package/dist/agent/act.js +7 -4
  3. package/dist/agent/action-dispatcher.js +4 -5
  4. package/dist/agent/actions.d.ts +32 -23
  5. package/dist/agent/actions.js +38 -24
  6. package/dist/agent/model/sdk.js +2 -0
  7. package/dist/agent/observation-feed.d.ts +5 -6
  8. package/dist/agent/observation-feed.js +5 -7
  9. package/dist/agent/observation.d.ts +40 -11
  10. package/dist/agent/observation.js +109 -59
  11. package/dist/agent/point-tap.d.ts +8 -8
  12. package/dist/agent/point-tap.js +1 -1
  13. package/dist/agent/replay.d.ts +19 -8
  14. package/dist/agent/replay.js +11 -14
  15. package/dist/agent/scroll-target.d.ts +2 -3
  16. package/dist/agent/step-cache.d.ts +41 -14
  17. package/dist/agent/step-cache.js +147 -62
  18. package/dist/agent/tool-loop.js +2 -0
  19. package/dist/cache/anchors.d.ts +72 -23
  20. package/dist/cache/anchors.js +233 -60
  21. package/dist/cache/context.d.ts +25 -14
  22. package/dist/cache/context.js +50 -8
  23. package/dist/cache/decide.d.ts +2 -2
  24. package/dist/cache/decide.js +4 -6
  25. package/dist/cache/identity.d.ts +18 -4
  26. package/dist/cache/identity.js +9 -4
  27. package/dist/cache/recorder.d.ts +15 -1
  28. package/dist/cache/recorder.js +36 -23
  29. package/dist/cache/rekeyed.d.ts +46 -0
  30. package/dist/cache/rekeyed.js +89 -0
  31. package/dist/cache/relocate.d.ts +14 -14
  32. package/dist/cache/relocate.js +33 -25
  33. package/dist/cache/route.d.ts +32 -33
  34. package/dist/cache/route.js +94 -50
  35. package/dist/cache/store.d.ts +6 -0
  36. package/dist/cache/store.js +21 -1
  37. package/dist/cache/trace.d.ts +53 -14
  38. package/dist/cache/trace.js +70 -28
  39. package/dist/cli/index.js +8 -8
  40. package/dist/cli/init/engines.d.ts +1 -3
  41. package/dist/cli/init/engines.js +2 -2
  42. package/dist/cli/init/gateways.d.ts +1 -1
  43. package/dist/cli/init/gateways.js +11 -1
  44. package/dist/cli/init/sibling-versions.json +1 -1
  45. package/dist/cli/init/versions.d.ts +0 -8
  46. package/dist/cli/init/versions.js +1 -10
  47. package/dist/config/resolve.d.ts +1 -0
  48. package/dist/config/resolve.js +33 -1
  49. package/dist/engine/index.d.ts +2 -2
  50. package/dist/expect/async.js +2 -1
  51. package/dist/expect/poll-scope.d.ts +52 -0
  52. package/dist/expect/poll-scope.js +113 -0
  53. package/dist/expect/poll.js +31 -4
  54. package/dist/expect/values.js +11 -4
  55. package/dist/internal/abandoned.d.ts +11 -0
  56. package/dist/internal/abandoned.js +23 -0
  57. package/dist/internal/brands.d.ts +2 -0
  58. package/dist/internal/brands.js +2 -0
  59. package/dist/internal/client-identity.d.ts +9 -0
  60. package/dist/internal/client-identity.js +14 -0
  61. package/dist/internal/redact.d.ts +7 -4
  62. package/dist/internal/redact.js +116 -23
  63. package/dist/internal/time.d.ts +6 -0
  64. package/dist/internal/time.js +25 -13
  65. package/dist/internal/urls.d.ts +9 -5
  66. package/dist/internal/urls.js +19 -10
  67. package/dist/locator/engine.d.ts +12 -2
  68. package/dist/locator/engine.js +8 -3
  69. package/dist/locator/screen.js +28 -4
  70. package/dist/mcp/catalog.d.ts +3 -2
  71. package/dist/mcp/catalog.js +6 -6
  72. package/dist/mcp/session.js +1 -1
  73. package/dist/oauth/chatgpt.js +3 -23
  74. package/dist/oauth/cli.js +1 -0
  75. package/dist/oauth/copilot.d.ts +5 -4
  76. package/dist/oauth/copilot.js +80 -7
  77. package/dist/oauth/grok.js +2 -1
  78. package/dist/oauth/models.js +2 -1
  79. package/dist/oauth/opencode-console.d.ts +10 -0
  80. package/dist/oauth/opencode-console.js +133 -0
  81. package/dist/oauth/providers/github-copilot.d.ts +12 -0
  82. package/dist/oauth/providers/github-copilot.js +77 -23
  83. package/dist/oauth/providers/opencode-console.d.ts +31 -0
  84. package/dist/oauth/providers/opencode-console.js +148 -0
  85. package/dist/oauth/providers.d.ts +2 -6
  86. package/dist/oauth/providers.js +3 -7
  87. package/dist/oauth/responses.d.ts +9 -0
  88. package/dist/oauth/responses.js +23 -0
  89. package/dist/report/build.d.ts +26 -0
  90. package/dist/report/build.js +16 -8
  91. package/dist/report/failure-text.d.ts +6 -1
  92. package/dist/report/failure-text.js +14 -4
  93. package/dist/report/format.d.ts +10 -5
  94. package/dist/report/format.js +12 -5
  95. package/dist/report/junit.js +11 -12
  96. package/dist/report/list.d.ts +1 -0
  97. package/dist/report/list.js +38 -18
  98. package/dist/report/markdown.d.ts +1 -1
  99. package/dist/report/markdown.js +37 -14
  100. package/dist/report/repeats.d.ts +6 -1
  101. package/dist/report/repeats.js +12 -3
  102. package/dist/run/artifacts.d.ts +18 -0
  103. package/dist/run/artifacts.js +68 -1
  104. package/dist/run/execute.d.ts +9 -0
  105. package/dist/run/execute.js +49 -24
  106. package/dist/run/extended-fixtures.js +6 -2
  107. package/dist/run/failure-evidence.js +4 -2
  108. package/dist/run/fixtures.js +6 -8
  109. package/dist/run/in-process.d.ts +2 -0
  110. package/dist/run/in-process.js +1 -0
  111. package/dist/run/last-run.d.ts +42 -8
  112. package/dist/run/last-run.js +121 -14
  113. package/dist/run/realm.d.ts +4 -1
  114. package/dist/run/realm.js +20 -6
  115. package/dist/run/records.d.ts +16 -0
  116. package/dist/run/records.js +26 -0
  117. package/dist/run/retry.d.ts +3 -1
  118. package/dist/run/retry.js +4 -2
  119. package/dist/run/runner.d.ts +1 -1
  120. package/dist/run/runner.js +69 -30
  121. package/dist/run/serial.d.ts +2 -0
  122. package/dist/run/serial.js +8 -5
  123. package/dist/run/steps.d.ts +0 -6
  124. package/dist/run/steps.js +3 -20
  125. package/dist/run/worker/entry.js +5 -4
  126. package/dist/run/worker/protocol.d.ts +2 -0
  127. package/dist/run/worker/session.d.ts +2 -0
  128. package/dist/run/worker/session.js +1 -0
  129. package/dist/telemetry/events.js +1 -0
  130. package/dist/types.d.ts +9 -3
  131. package/docs/agents.mdx +6 -3
  132. package/docs/assertions.mdx +94 -0
  133. package/docs/authentication.mdx +3 -1
  134. package/docs/browser.mdx +42 -6
  135. package/docs/cache.mdx +64 -18
  136. package/docs/ci.mdx +11 -7
  137. package/docs/debugging.mdx +6 -3
  138. package/docs/executors.mdx +4 -2
  139. package/docs/github.mdx +12 -4
  140. package/docs/{writing-tests.mdx → goals.mdx} +21 -101
  141. package/docs/index.mdx +4 -4
  142. package/docs/integrations/kernel.mdx +1 -1
  143. package/docs/locators.mdx +64 -0
  144. package/docs/migrate/cypress.mdx +2 -2
  145. package/docs/migrate/maestro.mdx +2 -2
  146. package/docs/migrate/playwright.mdx +19 -16
  147. package/docs/migrate/selenium.mdx +2 -2
  148. package/docs/mobile.mdx +21 -4
  149. package/docs/models.mdx +53 -7
  150. package/docs/physical-devices.mdx +76 -0
  151. package/docs/quickstart.mdx +4 -3
  152. package/docs/reference/app.mdx +1 -1
  153. package/docs/reference/cli.mdx +30 -13
  154. package/docs/reference/config.mdx +25 -7
  155. package/docs/reference/engine.mdx +3 -3
  156. package/docs/reference/environment.mdx +8 -1
  157. package/docs/reference/errors.mdx +5 -5
  158. package/docs/reference/expect.mdx +34 -12
  159. package/docs/reference/mobile.mdx +23 -13
  160. package/docs/reference/reporters.mdx +8 -2
  161. package/docs/reference/screen.mdx +30 -7
  162. package/docs/reference/test.mdx +11 -4
  163. package/docs/reference/web.mdx +125 -21
  164. package/docs/security.mdx +26 -16
  165. package/docs/subscriptions.mdx +91 -12
  166. package/docs/telemetry.mdx +1 -1
  167. package/package.json +16 -3
  168. package/schema/report-v1.schema.json +14 -1
  169. package/skills/e2e/SKILL.md +2 -2
  170. package/skills/e2e/references/agent.md +22 -11
  171. package/skills/e2e/references/debugging.md +4 -4
  172. package/skills/e2e/references/running.md +13 -8
  173. package/skills/e2e/references/setup.md +36 -15
  174. package/skills/e2e/references/writing-tests.md +34 -17
@@ -0,0 +1,9 @@
1
+ /** Helpers shared by the subscription models that ride the Responses API. */
2
+ import type { LanguageModelV4 } from '@ai-sdk/provider';
3
+ /**
4
+ * Tells the SDK what a subscription backend enforces: nothing is stored
5
+ * server side. Believing storage is on, the SDK refers back to an earlier
6
+ * turn's reasoning by id (`item_reference`), which the backend then cannot
7
+ * find; told it is off, the SDK carries the encrypted reasoning itself.
8
+ */
9
+ export declare function withoutServerStorage(model: LanguageModelV4): LanguageModelV4;
@@ -0,0 +1,23 @@
1
+ /** Helpers shared by the subscription models that ride the Responses API. */
2
+ /**
3
+ * Tells the SDK what a subscription backend enforces: nothing is stored
4
+ * server side. Believing storage is on, the SDK refers back to an earlier
5
+ * turn's reasoning by id (`item_reference`), which the backend then cannot
6
+ * find; told it is off, the SDK carries the encrypted reasoning itself.
7
+ */
8
+ export function withoutServerStorage(model) {
9
+ const storeOff = (options) => ({
10
+ ...options,
11
+ providerOptions: { ...options.providerOptions, openai: { ...options.providerOptions?.['openai'], store: false } },
12
+ });
13
+ return {
14
+ specificationVersion: model.specificationVersion,
15
+ provider: model.provider,
16
+ modelId: model.modelId,
17
+ get supportedUrls() {
18
+ return model.supportedUrls;
19
+ },
20
+ doGenerate: (options) => model.doGenerate(storeOff(options)),
21
+ doStream: (options) => model.doStream(storeOff(options)),
22
+ };
23
+ }
@@ -264,15 +264,36 @@ export interface ReportUsage {
264
264
  maxActionStepsInStep: number;
265
265
  estimatedCostUsd?: number;
266
266
  }
267
+ /**
268
+ * The run's counts by result. `passed`, `failed` (timed out included),
269
+ * `interrupted`, `flaky`, and `skipped` count selected results only and add
270
+ * up to `selected`; `discovered` minus `selected` is what the selection left
271
+ * out.
272
+ */
267
273
  export interface ReportSummary {
268
274
  discovered: number;
269
275
  selected: number;
270
276
  executed: number;
271
277
  passed: number;
272
278
  failed: number;
279
+ /** Stopped by the run (a signal, `--max-failures`, a run-level error) before reaching a verdict; never counted as failed. */
280
+ interrupted: number;
273
281
  flaky: number;
274
282
  skipped: number;
275
283
  }
284
+ /**
285
+ * What earlier runs left unresolved that a `--last-failed` rerun did not run
286
+ * again, because another filter left it out: the results as those runs
287
+ * reported them, the serial groups their members' attempts live on, and the
288
+ * suite hook failures whose scope still holds a carried test. The next
289
+ * `--last-failed` selects these tests too, so a test that never ran again
290
+ * stays owed until it does.
291
+ */
292
+ export interface ReportCarried {
293
+ results: readonly ReportResult[];
294
+ serialGroups: readonly ReportSerialGroup[];
295
+ errors: readonly ReportError[];
296
+ }
276
297
  export interface Report1Document {
277
298
  schemaVersion: 'report-1';
278
299
  run: {
@@ -309,6 +330,11 @@ export interface Report1Document {
309
330
  summary: ReportSummary;
310
331
  limits: ReportLimits;
311
332
  usage: ReportUsage;
333
+ /**
334
+ * Present on a `--last-failed` rerun that left out a test an earlier run
335
+ * did not pass. Not part of this run's status, exit code, or summary.
336
+ */
337
+ carried?: ReportCarried | undefined;
312
338
  /** Present on an `e2e explore` run only. */
313
339
  explore?: ReportExplore | undefined;
314
340
  };
@@ -8,6 +8,7 @@ import { resultId, timestamp } from '../internal/ids.js';
8
8
  import { obj } from '../internal/objects.js';
9
9
  import { packageVersion } from '../internal/package-version.js';
10
10
  import { projectRelativePath } from '../internal/source.js';
11
+ import { someSkippedAfterFailure } from '../run/records.js';
11
12
  /**
12
13
  * What a target's engine declaration says about it: the one description the
13
14
  * runner grades against and the report records. A target without an engine is
@@ -155,20 +156,22 @@ function serializeTarget(config, target, provenance) {
155
156
  ...(provenance ?? describeTarget(target)),
156
157
  };
157
158
  }
158
- /** Computes report-1 summary counts from results. */
159
+ /** Computes report-1 summary counts from results; the status counts are over the selected ones. */
159
160
  function computeSummary(results) {
160
161
  let selected = 0;
161
162
  let executed = 0;
162
163
  let passed = 0;
163
164
  let failed = 0;
165
+ let interrupted = 0;
164
166
  let flaky = 0;
165
167
  let skipped = 0;
166
168
  for (const result of results) {
167
- if (result.selected)
168
- selected += 1;
169
169
  if (result.attempts.length > 0 || (result.serialGroupId !== undefined && result.status !== 'skipped')) {
170
170
  executed += 1;
171
171
  }
172
+ if (!result.selected)
173
+ continue;
174
+ selected += 1;
172
175
  switch (result.status) {
173
176
  case 'passed':
174
177
  passed += 1;
@@ -178,15 +181,17 @@ function computeSummary(results) {
178
181
  break;
179
182
  case 'failed':
180
183
  case 'timed-out':
181
- case 'interrupted':
182
184
  failed += 1;
183
185
  break;
186
+ case 'interrupted':
187
+ interrupted += 1;
188
+ break;
184
189
  case 'skipped':
185
190
  skipped += 1;
186
191
  break;
187
192
  }
188
193
  }
189
- return { discovered: results.length, selected, executed, passed, failed, flaky, skipped };
194
+ return { discovered: results.length, selected, executed, passed, failed, interrupted, flaky, skipped };
190
195
  }
191
196
  /**
192
197
  * A run is `blocked` — not failed — when it did not pass and *every*
@@ -195,14 +200,17 @@ function computeSummary(results) {
195
200
  * nothing contradicts that. One genuine failure keeps the run failed, and so
196
201
  * does any run-level error (a launch that never came up, a cleanup or report
197
202
  * write that failed): it is its own fact about the run, not a blocked step,
198
- * and it must stay visible to a host reading the status. Derivation requires
203
+ * and it must stay visible to a host reading the status. So does a skip after
204
+ * a failure under `failOnSkippedFailure`. Derivation requires
199
205
  * positive evidence, never absence of it.
200
206
  */
201
- function deriveRunStatus(status, results, serialGroups, runErrors) {
207
+ function deriveRunStatus(status, results, serialGroups, runErrors, failOnSkippedFailure) {
202
208
  if (status !== 'failed' && status !== 'error')
203
209
  return status;
204
210
  if (runErrors.length > 0)
205
211
  return status;
212
+ if (failOnSkippedFailure && someSkippedAfterFailure(results, serialGroups))
213
+ return status;
206
214
  // Serial members carry no attempts of their own; their failing error lives
207
215
  // on the group's last attempt (or its failing member).
208
216
  const groupCode = new Map();
@@ -320,7 +328,7 @@ export function buildReport(options) {
320
328
  name: 'e2e',
321
329
  version: packageVersion(import.meta.url, '../../package.json', '0.0.0'),
322
330
  },
323
- status: deriveRunStatus(options.status, options.results, options.serialGroups, options.runErrors),
331
+ status: deriveRunStatus(options.status, options.results, options.serialGroups, options.runErrors, config?.failOnSkippedFailure === true),
324
332
  exitCode: options.exitCode,
325
333
  startedAt: options.startedAt,
326
334
  finishedAt: timestamp(),
@@ -34,7 +34,12 @@ export declare function detailLines(error: ReportError | undefined): string[];
34
34
  * called with, which reads as code.
35
35
  */
36
36
  export declare function stepLabel(step: ReportStep, max?: number): string;
37
- /** The attempt whose story a block tells: a flaky test's last failure, otherwise the final one. */
37
+ /**
38
+ * The attempt whose story a block tells: a flaky test's last failure; for a
39
+ * failed or timed-out test, the last attempt that reached that verdict, so a
40
+ * retry the run interrupted (or a serial member that retry never reached)
41
+ * tells nothing; otherwise the final one.
42
+ */
38
43
  export declare function toldAttempt(result: ReportResult, final: Outcome): AttemptView;
39
44
  /** A step that did not pass. */
40
45
  export type FailedStep = ReportStep & {
@@ -69,9 +69,19 @@ function screenUrl(url) {
69
69
  return url;
70
70
  }
71
71
  }
72
- /** The attempt whose story a block tells: a flaky test's last failure, otherwise the final one. */
72
+ /**
73
+ * The attempt whose story a block tells: a flaky test's last failure; for a
74
+ * failed or timed-out test, the last attempt that reached that verdict, so a
75
+ * retry the run interrupted (or a serial member that retry never reached)
76
+ * tells nothing; otherwise the final one.
77
+ */
73
78
  export function toldAttempt(result, final) {
74
- return result.status === 'flaky' ? (final.lastFailed ?? final.final) : final.final;
79
+ if (result.status === 'flaky')
80
+ return final.lastFailed ?? final.final;
81
+ if (result.status === 'failed' || result.status === 'timed-out') {
82
+ return final.attempts.findLast((attempt) => attempt.status === 'failed' || attempt.status === 'timed-out') ?? final.final;
83
+ }
84
+ return final.final;
75
85
  }
76
86
  /** The step a failure happened at: the first that did not pass, with its position. */
77
87
  export function failedStepOf(steps) {
@@ -87,9 +97,9 @@ export function failedStepOf(steps) {
87
97
  */
88
98
  export function attemptsLine(result, final) {
89
99
  // An attempt that recorded nothing for this test (a serial group that never
90
- // reached the member) says nothing about how the test fails.
100
+ // reached the member), or one the run interrupted, says nothing about how the test fails.
91
101
  const failed = final.attempts
92
- .filter((attempt) => attempt.status !== 'passed' && attempt.status !== 'skipped' && (attempt.error !== undefined || attempt.steps.length > 0))
102
+ .filter((attempt) => attempt.status !== 'passed' && attempt.status !== 'skipped' && attempt.status !== 'interrupted' && (attempt.error !== undefined || attempt.steps.length > 0))
93
103
  .map((attempt) => ({
94
104
  code: cell(attempt.error?.code ?? attempt.status, 128),
95
105
  step: failedStepOf(attempt.steps)?.index,
@@ -58,20 +58,25 @@ export declare function rule(text: string, align: 'center' | 'right'): {
58
58
  export interface Counters {
59
59
  passed: number;
60
60
  failed: number;
61
+ interrupted: number;
61
62
  flaky: number;
62
63
  skipped: number;
63
64
  total: number;
64
65
  }
65
66
  export declare function emptyCounters(): Counters;
66
- /** The counter a result status lands in: every non-success status is a failure. */
67
- export declare function statusBucket(status: ResultStatus): 'passed' | 'failed' | 'flaky' | 'skipped';
67
+ /**
68
+ * The counter a result status lands in. A timeout is a failure; an
69
+ * interrupted test was stopped by the run, not by its own verdict, so it
70
+ * counts on its own.
71
+ */
72
+ export declare function statusBucket(status: ResultStatus): 'passed' | 'failed' | 'interrupted' | 'flaky' | 'skipped';
68
73
  /** Counts results by bucket; `total` is the number of items. */
69
74
  export declare function tally(items: readonly {
70
75
  readonly status: ResultStatus;
71
76
  }[]): Counters;
72
- /** A file's outcome from its tests: failed if any did, skipped if all did, else passed. */
73
- export declare function fileOutcome(counters: Counters): 'passed' | 'failed' | 'skipped';
74
- /** `2 failed | 10 passed | 1 flaky (13)` in vitest's colors and order. */
77
+ /** A file's outcome from its tests: failed if any did, else interrupted if any was, skipped if all were, else passed. */
78
+ export declare function fileOutcome(counters: Counters): 'passed' | 'failed' | 'interrupted' | 'skipped';
79
+ /** `2 failed | 1 interrupted | 10 passed | 1 flaky (14)` in vitest's colors and order. */
75
80
  export declare function stateString(pc: Colors, counters: Counters): string;
76
81
  export interface AiUsage {
77
82
  calls: number;
@@ -96,11 +96,15 @@ export function rule(text, align) {
96
96
  return { before: LONG_DASH.repeat(before), after: LONG_DASH.repeat(after) };
97
97
  }
98
98
  export function emptyCounters() {
99
- return { passed: 0, failed: 0, flaky: 0, skipped: 0, total: 0 };
99
+ return { passed: 0, failed: 0, interrupted: 0, flaky: 0, skipped: 0, total: 0 };
100
100
  }
101
- /** The counter a result status lands in: every non-success status is a failure. */
101
+ /**
102
+ * The counter a result status lands in. A timeout is a failure; an
103
+ * interrupted test was stopped by the run, not by its own verdict, so it
104
+ * counts on its own.
105
+ */
102
106
  export function statusBucket(status) {
103
- return status === 'passed' || status === 'flaky' || status === 'skipped' ? status : 'failed';
107
+ return status === 'timed-out' ? 'failed' : status;
104
108
  }
105
109
  /** Counts results by bucket; `total` is the number of items. */
106
110
  export function tally(items) {
@@ -111,18 +115,21 @@ export function tally(items) {
111
115
  }
112
116
  return counters;
113
117
  }
114
- /** A file's outcome from its tests: failed if any did, skipped if all did, else passed. */
118
+ /** A file's outcome from its tests: failed if any did, else interrupted if any was, skipped if all were, else passed. */
115
119
  export function fileOutcome(counters) {
116
120
  if (counters.failed > 0)
117
121
  return 'failed';
122
+ if (counters.interrupted > 0)
123
+ return 'interrupted';
118
124
  if (counters.total > 0 && counters.skipped === counters.total)
119
125
  return 'skipped';
120
126
  return 'passed';
121
127
  }
122
- /** `2 failed | 10 passed | 1 flaky (13)` in vitest's colors and order. */
128
+ /** `2 failed | 1 interrupted | 10 passed | 1 flaky (14)` in vitest's colors and order. */
123
129
  export function stateString(pc, counters) {
124
130
  const parts = [
125
131
  counters.failed > 0 ? pc.bold(pc.red(`${counters.failed} failed`)) : undefined,
132
+ counters.interrupted > 0 ? pc.bold(pc.yellow(`${counters.interrupted} interrupted`)) : undefined,
126
133
  pc.bold(pc.green(`${counters.passed} passed`)),
127
134
  counters.flaky > 0 ? pc.yellow(`${counters.flaky} flaky`) : undefined,
128
135
  counters.skipped > 0 ? pc.gray(`${counters.skipped} skipped`) : undefined,
@@ -1,6 +1,7 @@
1
1
  /** JUnit XML reporter: the report-1 document as `.e2e/junit.xml`. */
2
2
  import { sanitizeText } from '../internal/errors.js';
3
3
  import { repeatSuffix } from './format.js';
4
+ import { toldAttempt } from './failure-text.js';
4
5
  import { outcome } from './outcome.js';
5
6
  import { fileReporter } from './write.js';
6
7
  /**
@@ -60,11 +61,9 @@ function addCounts(total, part) {
60
61
  total.skipped += part.skipped;
61
62
  total.timeMs += part.timeMs;
62
63
  }
63
- /** `<failure>` for a product verdict, `<error>` for anything that prevented one. */
64
- function verdictElement(error, status) {
65
- if (error !== undefined)
66
- return error.category === 'test' ? 'failure' : 'error';
67
- return status === 'interrupted' ? 'error' : 'failure';
64
+ /** `<failure>` for a product verdict, `<error>` for anything else that prevented one. */
65
+ function verdictElement(error) {
66
+ return error === undefined || error.category === 'test' ? 'failure' : 'error';
68
67
  }
69
68
  function errorBody(error) {
70
69
  const phase = error.phase === undefined ? '' : ` (${error.phase})`;
@@ -93,18 +92,18 @@ function renderResult(result, groups) {
93
92
  };
94
93
  }
95
94
  case 'skipped':
95
+ case 'interrupted': {
96
+ // JUnit has no interrupted outcome; a test the run stopped reached no verdict, so it reads as skipped with why.
97
+ const message = result.status === 'skipped' ? (result.skip?.reason ?? 'skipped') : `interrupted: ${final.final.error?.message ?? 'the run was stopped'}`;
96
98
  return {
97
- lines: [
98
- `${open}>`,
99
- ` <skipped ${attributes({ message: result.skip?.reason ?? 'skipped' })}/>`,
100
- '</testcase>',
101
- ],
99
+ lines: [`${open}>`, ` <skipped ${attributes({ message })}/>`, '</testcase>'],
102
100
  outcome: 'skipped',
103
101
  durationMs: final.durationMs,
104
102
  };
103
+ }
105
104
  default: {
106
- const element = verdictElement(final.final.error, result.status);
107
- const error = final.final.error;
105
+ const error = toldAttempt(result, final).error;
106
+ const element = verdictElement(error);
108
107
  const message = error?.message ?? result.status;
109
108
  const type = error?.code ?? result.status;
110
109
  const body = error === undefined ? result.status : errorBody(error);
@@ -49,6 +49,7 @@ export declare class ListReporter implements Reporter {
49
49
  /** Whether a live window paints; without one, finished steps stream permanently. */
50
50
  private readonly live;
51
51
  private readonly failures;
52
+ private readonly skippedFailures;
52
53
  /** Every finished test's run, for the `Repeats` summary of a `--repeat-each` run. */
53
54
  private readonly runs;
54
55
  /**
@@ -8,6 +8,7 @@
8
8
  import path from 'node:path';
9
9
  import picocolors from 'picocolors';
10
10
  import { packageVersion } from '../internal/package-version.js';
11
+ import { failureBeforeSkip } from '../run/records.js';
11
12
  import { codeFrame, userFrame } from './code-frame.js';
12
13
  import { addCacheTally, addModelTally, addUsage, aiSegment, bounded, cacheText, durationText, fitColumns, emptyCacheTally, emptyCounters, emptyUsage, F_CHECK, F_CROSS, F_POINTER, fileOutcome, formatClock, formatTime, modelsText, padTitle, rule, stateString, statusBucket, stepsCacheTally, repeatSuffix, stepsModelTally, stepsUsage, sumUsage, tally, terminalColumns, usageText, } from './format.js';
13
14
  import { ExploreView } from './list-explore.js';
@@ -43,14 +44,16 @@ function pairKey(testId, agent, target, repeat) {
43
44
  /** Details of an ordinary result: summed over its attempts, the error from the last. */
44
45
  function attemptDetails(attempts) {
45
46
  const steps = attempts.map((attempt) => attempt.steps);
47
+ // A retry the run interrupted tells nothing; the failure before it is the verdict.
48
+ const told = attempts.findLast((attempt) => attempt.status !== 'interrupted') ?? attempts.at(-1);
46
49
  return {
47
50
  durationMs: attempts.reduce((total, attempt) => total + attempt.durationMs, 0),
48
51
  usage: stepsUsage(steps),
49
52
  models: stepsModelTally(steps),
50
53
  cache: stepsCacheTally(steps),
51
- error: attempts[attempts.length - 1]?.error,
54
+ error: told?.error,
52
55
  videos: videoPaths(attempts),
53
- ...failureOf(attempts[attempts.length - 1]),
56
+ ...failureOf(told),
54
57
  };
55
58
  }
56
59
  /** The failure evidence of one attempt, and the path of the screen text it points at. */
@@ -85,7 +88,7 @@ function serialMemberDetails(group, testId) {
85
88
  attempt,
86
89
  member: attempt.members.find((member) => member.testId === testId),
87
90
  }));
88
- const last = runs[runs.length - 1];
91
+ const last = runs.findLast((run) => run.attempt.status !== 'interrupted') ?? runs.at(-1);
89
92
  const own = last?.member;
90
93
  const neverRan = own === undefined || own.status === 'skipped';
91
94
  const steps = runs.map((run) => run.member?.steps ?? []);
@@ -135,6 +138,7 @@ export class ListReporter {
135
138
  /** Whether a live window paints; without one, finished steps stream permanently. */
136
139
  live;
137
140
  failures = [];
141
+ skippedFailures = [];
138
142
  /** Every finished test's run, for the `Repeats` summary of a `--repeat-each` run. */
139
143
  runs = [];
140
144
  /**
@@ -550,15 +554,17 @@ export class ListReporter {
550
554
  const steps = this.pairs.get(key)?.steps ?? [];
551
555
  this.pairs.delete(key);
552
556
  const group = this.group(result.test.file, result.target.name);
557
+ // Read before `detailsOf` releases the result's serial group.
558
+ const skippedAfter = failureBeforeSkip(result, (id) => this.pendingSerial.get(id)?.group);
553
559
  const { durationMs, usage, models, cache, error, videos, failure, screenPath } = this.detailsOf(result);
554
560
  addUsage(this.runUsage, usage);
555
561
  addModelTally(this.runModels, models);
556
562
  addCacheTally(this.runCache, cache);
557
563
  const title = this.titledAs(result.test.titlePath.join(' > '), result.agent, result.repeat);
558
564
  if (this.explore !== undefined) {
559
- // The exploration's verdict is its findings; any other error is a failure of its own.
565
+ // The exploration's verdict is its findings; any other error is a failure of its own, unless the run stopped it.
560
566
  this.explore.result(result.attempts.flatMap((attempt) => attempt.artifacts));
561
- if (error !== undefined && !this.explore.isVerdict(error)) {
567
+ if (error !== undefined && result.status !== 'interrupted' && !this.explore.isVerdict(error)) {
562
568
  this.failures.push({ group, title, status: result.status, error, videos, failure, screenPath });
563
569
  }
564
570
  this.window.redraw();
@@ -584,6 +590,9 @@ export class ListReporter {
584
590
  if (statusBucket(result.status) === 'failed') {
585
591
  this.failures.push({ group, title, status: result.status, error, videos, failure, screenPath });
586
592
  }
593
+ if (skippedAfter !== undefined) {
594
+ this.skippedFailures.push({ group, title, status: result.status, error: skippedAfter.error, videos, ...failureOf(skippedAfter) });
595
+ }
587
596
  if (group.planned !== undefined && group.lines.length >= group.planned)
588
597
  this.printGroup(group);
589
598
  this.window.redraw();
@@ -623,12 +632,15 @@ export class ListReporter {
623
632
  const outcome = fileOutcome(counts);
624
633
  const symbol = outcome === 'failed'
625
634
  ? pc.red(F_POINTER)
626
- : outcome === 'skipped'
627
- ? pc.dim(pc.gray(F_DOWN))
628
- : pc.green(F_CHECK);
635
+ : outcome === 'interrupted'
636
+ ? pc.yellow(F_POINTER)
637
+ : outcome === 'skipped'
638
+ ? pc.dim(pc.gray(F_DOWN))
639
+ : pc.green(F_CHECK);
629
640
  const state = [
630
641
  pc.dim(`${counts.total} test${counts.total === 1 ? '' : 's'}`),
631
642
  counts.failed > 0 ? pc.red(`${counts.failed} failed`) : undefined,
643
+ counts.interrupted > 0 ? pc.yellow(`${counts.interrupted} interrupted`) : undefined,
632
644
  counts.flaky > 0 ? pc.yellow(`${counts.flaky} flaky`) : undefined,
633
645
  counts.skipped > 0 ? pc.yellow(`${counts.skipped} skipped`) : undefined,
634
646
  ]
@@ -647,6 +659,7 @@ export class ListReporter {
647
659
  parts.push(pc.dim(ai));
648
660
  this.print(parts.join(' '));
649
661
  const verbose = counts.failed > 0 ||
662
+ counts.interrupted > 0 ||
650
663
  counts.flaky > 0 ||
651
664
  this.groups.size === 1 ||
652
665
  (this.live && group.lines.some((line) => line.steps.length > 0));
@@ -678,6 +691,8 @@ export class ListReporter {
678
691
  : pc.dim(pc.gray(` [${line.skipReason}]`));
679
692
  return [` ${pc.dim(pc.gray(F_DOWN))} ${line.title}${reason}`];
680
693
  }
694
+ case 'interrupted':
695
+ return [` ${pc.yellow(F_CROSS)} ${line.title} ${pc.yellow('(interrupted)')} ${duration}${ai}`];
681
696
  default: {
682
697
  const status = line.status === 'failed' ? '' : pc.red(` (${line.status})`);
683
698
  const rows = [` ${pc.red(`${F_CROSS} ${line.title}`)}${status} ${duration}${ai}`];
@@ -716,6 +731,9 @@ export class ListReporter {
716
731
  rows.push(padTitle(pc, 'Cache') + cache);
717
732
  if (final)
718
733
  rows.push(...this.repeatRows());
734
+ if (this.skippedFailures.length > 0) {
735
+ rows.push(padTitle(pc, 'Warnings') + pc.yellow(`${this.skippedFailures.length} skipped after failure`));
736
+ }
719
737
  if (this.errors.length > 0) {
720
738
  const count = this.errors.length;
721
739
  rows.push(padTitle(pc, 'Errors') + pc.bold(pc.red(`${count} error${count === 1 ? '' : 's'}`)));
@@ -736,11 +754,12 @@ export class ListReporter {
736
754
  const groups = repeatGroups(this.runs, (entry) => entry);
737
755
  if (groups.length === 0)
738
756
  return [];
739
- const unstable = groups.filter((group) => group.passed < group.runs.length);
757
+ // A test is listed when it missed a run: a flake first, then one the run cut short.
758
+ const missed = groups.filter((group) => group.passed < group.runs.length).toSorted((a, b) => Number(b.unstable) - Number(a.unstable));
740
759
  const summary = repeatSummary(groups);
741
760
  return [
742
- padTitle(pc, 'Repeats') + (unstable.length === 0 ? pc.green(summary) : pc.yellow(summary)),
743
- ...unstable.map((group) => `${padTitle(pc, '')}${pc.yellow(F_CROSS)} ${group.label} ${pc.dim(repeatLine(group))}`),
761
+ padTitle(pc, 'Repeats') + (missed.some((group) => group.unstable) ? pc.yellow(summary) : pc.green(summary)),
762
+ ...missed.map((group) => `${padTitle(pc, '')}${group.unstable ? pc.yellow(F_CROSS) : pc.dim(pc.gray(F_DOWN))} ${group.label} ${pc.dim(repeatLine(group))}`),
744
763
  ];
745
764
  }
746
765
  /** A zero counter's label: the plain text, or the interrupt when that is why nothing is counted. */
@@ -808,15 +827,15 @@ export class ListReporter {
808
827
  this.print(line);
809
828
  }
810
829
  /** vitest's `Failed Tests` section: a banner, then each failure with its code frame. */
811
- printFailures() {
830
+ printFailures(heading, failures) {
812
831
  const { pc } = this;
813
- if (this.failures.length === 0)
832
+ if (failures.length === 0)
814
833
  return;
815
834
  this.print('');
816
- this.print(this.errorBanner(`Failed Tests ${this.failures.length}`));
835
+ this.print(this.errorBanner(`${heading} ${failures.length}`));
817
836
  this.print('');
818
- this.failures.forEach(({ group, title, status, error, videos, failure, screenPath }, index) => {
819
- this.print(`${pc.bold(pc.bgRed(' FAIL '))} ${this.badge(group.target)} ${bounded(group.file)}${this.separator}${title}`);
837
+ failures.forEach(({ group, title, status, error, videos, failure, screenPath }, index) => {
838
+ this.print(`${pc.bold(pc.bgRed(status === 'skipped' ? ' SKIP ' : ' FAIL '))} ${this.badge(group.target)} ${bounded(group.file)}${this.separator}${title}`);
820
839
  if (error === undefined) {
821
840
  this.print(pc.red(`${pc.bold(status)}: no error was recorded`));
822
841
  }
@@ -829,7 +848,7 @@ export class ListReporter {
829
848
  }
830
849
  this.printEvidence(failure, screenPath);
831
850
  this.printVideos(videos);
832
- const marker = `[${index + 1}/${this.failures.length}]`;
851
+ const marker = `[${index + 1}/${failures.length}]`;
833
852
  const { before, after } = rule(marker, 'right');
834
853
  this.print('');
835
854
  this.print(pc.red(pc.dim(`${before}${marker}${after}`)));
@@ -925,7 +944,8 @@ export class ListReporter {
925
944
  this.printGroup(group);
926
945
  }
927
946
  this.printExplore();
928
- this.printFailures();
947
+ this.printFailures('Failed Tests', this.failures);
948
+ this.printFailures('Skipped After Failure', this.skippedFailures);
929
949
  this.printErrors();
930
950
  this.print('');
931
951
  for (const row of this.summaryRows(true))
@@ -50,7 +50,7 @@ export declare function renderMarkdownReport(report: Report1Document, options?:
50
50
  * `summary.md` beside `report.json`, with evidence listed as paths from the
51
51
  * project root, for a reader with the checkout in front of it: a pull
52
52
  * request description, a coding agent's handoff, a wiki page. Every test
53
- * that did not pass gets a page of its own under `failures/`, with the
53
+ * that failed or was flaky gets a page of its own under `failures/`, with the
54
54
  * screen at failure inline; the run page links each block to its page. The
55
55
  * directory is the reporter's: what an earlier run left there is removed
56
56
  * first, so a stale page never describes a failure this run did not have.
@@ -45,11 +45,11 @@ const MAX_GOAL_CHARS = 400;
45
45
  const TRUNCATED_NOTE = '_Truncated to fit a pull request comment; the full report is in `report.json`._';
46
46
  /** Screenshots first, then the recording, then the trace; the compiler fails when a kind is missing here. */
47
47
  const KIND_RANK = { screenshot: 0, video: 1, trace: 2, download: 3, log: 4 };
48
- const ICON = { failed: '🔴', flaky: '⚠️', skipped: '⏭️', passed: '🟢' };
48
+ const ICON = { failed: '🔴', interrupted: '⏹️', flaky: '⚠️', skipped: '⏭️', passed: '🟢' };
49
49
  /** Worst first: the order failures are listed, files are sorted, and a file's glyph is chosen in. */
50
- const WORST_FIRST = ['failed', 'flaky', 'skipped', 'passed'];
51
- /** The order counts read in: `1 failed, 1 flaky, 3 passed, 1 skipped`. */
52
- const COUNT_ORDER = ['failed', 'flaky', 'passed', 'skipped'];
50
+ const WORST_FIRST = ['failed', 'interrupted', 'flaky', 'skipped', 'passed'];
51
+ /** The order counts read in: `1 failed, 2 interrupted, 1 flaky, 3 passed, 1 skipped`. */
52
+ const COUNT_ORDER = ['failed', 'interrupted', 'flaky', 'passed', 'skipped'];
53
53
  function worstBucket(results) {
54
54
  const present = new Set(results.map((result) => statusBucket(result.status)));
55
55
  return WORST_FIRST.find((key) => present.has(key)) ?? 'passed';
@@ -65,9 +65,25 @@ function pageName(options) {
65
65
  const title = options.title?.trim() ?? '';
66
66
  return title === '' ? 'e2e' : `e2e ${cell(title, MAX_ID_CHARS)}`;
67
67
  }
68
+ /**
69
+ * The headline's glyph: red for a failed run or any failed test, the
70
+ * interrupted glyph for a run or a listed test the run stopped, else green.
71
+ * A `--last-failed` rerun that passed can still list a test the first pass
72
+ * never finished, and the page must not read as all green.
73
+ */
74
+ function runIcon(run, results) {
75
+ if (run.status !== 'passed' && run.status !== 'interrupted')
76
+ return ICON.failed;
77
+ const worst = worstBucket(results);
78
+ if (worst === 'failed')
79
+ return ICON.failed;
80
+ if (worst === 'interrupted' || run.status === 'interrupted')
81
+ return ICON.interrupted;
82
+ return ICON.passed;
83
+ }
68
84
  function headline(run, results, options) {
69
85
  const summary = countText(tally(results)) || (run.errors.length > 0 ? 'no tests ran' : 'no tests selected');
70
- return `### ${run.status === 'passed' ? ICON.passed : ICON.failed} ${pageName(options)}: ${summary}`;
86
+ return `### ${runIcon(run, results)} ${pageName(options)}: ${summary}`;
71
87
  }
72
88
  /** The model calls an agent step made; the step's metrics are the source of truth. */
73
89
  function modelCalls(step) {
@@ -236,6 +252,12 @@ function flakyFold(entries, manyTargets, options) {
236
252
  const summary = `${ICON.flaky} ${plural(entries.length, 'flaky test')} passed on a retry`;
237
253
  return [['<details>', `<summary>${summary}</summary>`, '', shown.join('\n\n'), '</details>'].join('\n')];
238
254
  }
255
+ /** A test that missed a run: flaky when a run failed, else interrupted when the run stopped one, else skipped. */
256
+ function missIcon(group) {
257
+ if (group.unstable)
258
+ return ICON.flaky;
259
+ return group.runs.some((run) => run.status === 'interrupted') ? ICON.interrupted : ICON.skipped;
260
+ }
239
261
  /**
240
262
  * A `--repeat-each` run's tally: how many tests passed every run, then each
241
263
  * test that did not, with the runs that failed. Empty for a run that
@@ -254,10 +276,11 @@ function repeatsSection(entries, manyTargets) {
254
276
  }));
255
277
  if (groups.length === 0)
256
278
  return [];
257
- const unstable = groups.filter((group) => group.passed < group.runs.length);
279
+ // A test is listed when it missed a run: a flake first, then one the run cut short.
280
+ const missed = groups.filter((group) => group.passed < group.runs.length).toSorted((a, b) => Number(b.unstable) - Number(a.unstable));
258
281
  return [
259
282
  `**Repeats:** ${repeatSummary(groups)}`,
260
- ...(unstable.length === 0 ? [] : ['', ...unstable.map((group) => `- ${ICON.flaky} ${group.label}: ${cell(repeatLine(group))}`)]),
283
+ ...(missed.length === 0 ? [] : ['', ...missed.map((group) => `- ${missIcon(group)} ${group.label}: ${cell(repeatLine(group))}`)]),
261
284
  ];
262
285
  }
263
286
  /** Results grouped by file and target, the worst file first, then by path. */
@@ -353,12 +376,12 @@ function footer(run, targets, options) {
353
376
  return [`<sub>${parts.join(' · ')}</sub>`];
354
377
  }
355
378
  // --- the exploration record ---
356
- function exploreHeadline(run, explore, options) {
379
+ function exploreHeadline(run, results, explore, options) {
357
380
  const issues = explore.findings.filter((finding) => finding.kind === 'issue').length;
358
381
  const warnings = explore.findings.length - issues;
359
382
  const counts = [...(issues > 0 ? [plural(issues, 'issue')] : []), ...(warnings > 0 ? [plural(warnings, 'warning')] : [])];
360
383
  const summary = counts.length > 0 ? counts.join(', ') : run.status === 'blocked' ? 'explored nothing' : run.status === 'passed' ? 'no findings' : 'did not finish';
361
- return `### ${run.status === 'passed' ? ICON.passed : ICON.failed} ${pageName(options)} explore: ${summary}`;
384
+ return `### ${runIcon(run, results)} ${pageName(options)} explore: ${summary}`;
362
385
  }
363
386
  /** `3 of 8 steps · 2 passed · 1 failed · the agent covered the goal`. */
364
387
  function exploreSteps(explore) {
@@ -448,7 +471,7 @@ export function renderMarkdownReport(report, options = {}) {
448
471
  failures.push([`and ${failed.length - failures.length} more failed`]);
449
472
  const flaky = flakyFold(notPassed.filter(({ result }) => statusBucket(result.status) === 'flaky'), manyTargets, options);
450
473
  const spend = spendLine(run, entries);
451
- const head = [explore === undefined ? headline(run, selected, options) : exploreHeadline(run, explore, options), ...(spend === undefined ? [] : [spend]), ''];
474
+ const head = [explore === undefined ? headline(run, selected, options) : exploreHeadline(run, selected, explore, options), ...(spend === undefined ? [] : [spend]), ''];
452
475
  const groups = fileGroups(entries);
453
476
  const sections = explore === undefined
454
477
  ? [errors, ...failures, flaky, repeatsSection(entries, manyTargets), allTests(groups, selected.length, manyTargets)]
@@ -468,9 +491,9 @@ function failurePageName(result) {
468
491
  return `${sanitizePathSegment(`${result.file}-${result.titlePath.join('-')}`)}-${result.id.slice(0, 8)}.md`;
469
492
  }
470
493
  /**
471
- * The results that get a page: every one that failed, timed out, was
472
- * interrupted, or was flaky, except an exploration's own verdict, which its
473
- * findings already tell.
494
+ * The results that get a page: every one that failed, timed out, or was
495
+ * flaky, except an exploration's own verdict, which its findings already
496
+ * tell. An interrupted test reached no verdict, so it has no failure to tell.
474
497
  */
475
498
  function pagedResults(report) {
476
499
  const explore = report.run.explore;
@@ -487,7 +510,7 @@ function pagedResults(report) {
487
510
  * `summary.md` beside `report.json`, with evidence listed as paths from the
488
511
  * project root, for a reader with the checkout in front of it: a pull
489
512
  * request description, a coding agent's handoff, a wiki page. Every test
490
- * that did not pass gets a page of its own under `failures/`, with the
513
+ * that failed or was flaky gets a page of its own under `failures/`, with the
491
514
  * screen at failure inline; the run page links each block to its page. The
492
515
  * directory is the reporter's: what an earlier run left there is removed
493
516
  * first, so a stale page never describes a failure this run did not have.