@testsprite/testsprite-cli 0.15.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 (207) hide show
  1. package/README.md +53 -141
  2. package/dist/commands/agent.d.ts +12 -4
  3. package/dist/commands/agent.js +55 -65
  4. package/dist/commands/auth.d.ts +6 -10
  5. package/dist/commands/auth.js +44 -56
  6. package/dist/commands/ci.d.ts +23 -100
  7. package/dist/commands/ci.js +297 -489
  8. package/dist/commands/completion.js +2 -1
  9. package/dist/commands/conversation.d.ts +27 -0
  10. package/dist/commands/conversation.js +702 -0
  11. package/dist/commands/doctor.d.ts +5 -1
  12. package/dist/commands/doctor.js +130 -34
  13. package/dist/commands/init.d.ts +4 -45
  14. package/dist/commands/init.js +116 -68
  15. package/dist/commands/project-env.d.ts +62 -2
  16. package/dist/commands/project-env.js +426 -53
  17. package/dist/commands/project-sign-in.d.ts +0 -48
  18. package/dist/commands/project-sign-in.js +1 -224
  19. package/dist/commands/project.d.ts +15 -186
  20. package/dist/commands/project.js +93 -921
  21. package/dist/commands/result.d.ts +10 -0
  22. package/dist/commands/result.js +215 -0
  23. package/dist/commands/schedule.d.ts +0 -29
  24. package/dist/commands/schedule.js +47 -97
  25. package/dist/commands/test.d.ts +315 -1824
  26. package/dist/commands/test.js +1962 -13733
  27. package/dist/commands/testlist.d.ts +128 -5
  28. package/dist/commands/testlist.js +269 -329
  29. package/dist/commands/tunnel.d.ts +2 -2
  30. package/dist/commands/tunnel.js +43 -41
  31. package/dist/commands/usage.d.ts +12 -45
  32. package/dist/commands/usage.js +51 -131
  33. package/dist/index.js +189 -108
  34. package/dist/lib/agent-detect.js +9 -5
  35. package/dist/lib/agent-targets.d.ts +21 -2
  36. package/dist/lib/agent-targets.js +88 -11
  37. package/dist/lib/args.d.ts +13 -0
  38. package/dist/lib/args.js +49 -0
  39. package/dist/lib/basic-auth.d.ts +3 -0
  40. package/dist/lib/basic-auth.js +15 -0
  41. package/dist/lib/billing-refusal.js +4 -3
  42. package/dist/lib/ci-linkage.d.ts +4 -82
  43. package/dist/lib/ci-linkage.js +4 -157
  44. package/dist/lib/ci-run.js +1 -1
  45. package/dist/lib/client-factory.d.ts +10 -2
  46. package/dist/lib/client-factory.js +38 -26
  47. package/dist/lib/commit-signal.d.ts +65 -0
  48. package/dist/lib/commit-signal.js +305 -0
  49. package/dist/lib/concurrency-limiter.d.ts +6 -0
  50. package/dist/lib/concurrency-limiter.js +29 -0
  51. package/dist/lib/config.js +10 -5
  52. package/dist/lib/conflict-reason.d.ts +31 -4
  53. package/dist/lib/conflict-reason.js +38 -4
  54. package/dist/lib/conversation/answers.d.ts +9 -0
  55. package/dist/lib/conversation/answers.js +49 -0
  56. package/dist/lib/conversation/api.d.ts +71 -0
  57. package/dist/lib/conversation/api.js +150 -0
  58. package/dist/lib/conversation/change.d.ts +31 -0
  59. package/dist/lib/conversation/change.js +124 -0
  60. package/dist/lib/conversation/context.d.ts +19 -0
  61. package/dist/lib/conversation/context.js +70 -0
  62. package/dist/lib/conversation/environment.d.ts +15 -0
  63. package/dist/lib/conversation/environment.js +33 -0
  64. package/dist/lib/conversation/follow.d.ts +24 -0
  65. package/dist/lib/conversation/follow.js +42 -0
  66. package/dist/lib/conversation/render.d.ts +33 -0
  67. package/dist/lib/conversation/render.js +315 -0
  68. package/dist/lib/conversation/title.d.ts +2 -0
  69. package/dist/lib/conversation/title.js +18 -0
  70. package/dist/lib/conversation/types.d.ts +156 -0
  71. package/dist/lib/conversation/types.js +6 -0
  72. package/dist/lib/credentials.js +67 -11
  73. package/dist/lib/cron.d.ts +1 -1
  74. package/dist/lib/cron.js +2 -2
  75. package/dist/lib/dispatch-stop.d.ts +20 -0
  76. package/dist/lib/dispatch-stop.js +30 -0
  77. package/dist/lib/download.d.ts +71 -0
  78. package/dist/lib/download.js +274 -0
  79. package/dist/lib/dry-run/fetch.d.ts +10 -0
  80. package/dist/lib/dry-run/fetch.js +20 -0
  81. package/dist/lib/dry-run/samples.d.ts +6 -34
  82. package/dist/lib/dry-run/samples.js +389 -751
  83. package/dist/lib/environment-tunnel.d.ts +16 -26
  84. package/dist/lib/environment-tunnel.js +161 -157
  85. package/dist/lib/errors.d.ts +20 -4
  86. package/dist/lib/errors.js +36 -16
  87. package/dist/lib/facade.d.ts +7 -29
  88. package/dist/lib/facade.js +7 -36
  89. package/dist/lib/failing-fe-resolver.d.ts +13 -58
  90. package/dist/lib/failing-fe-resolver.js +47 -132
  91. package/dist/lib/first-suite-hint.d.ts +16 -22
  92. package/dist/lib/first-suite-hint.js +38 -47
  93. package/dist/lib/gh-output.d.ts +76 -21
  94. package/dist/lib/gh-output.js +171 -90
  95. package/dist/lib/git-utils.d.ts +56 -0
  96. package/dist/lib/git-utils.js +212 -0
  97. package/dist/lib/github-context.d.ts +2 -0
  98. package/dist/lib/github-context.js +40 -8
  99. package/dist/lib/history-retention.d.ts +6 -2
  100. package/dist/lib/history-retention.js +10 -7
  101. package/dist/lib/http.d.ts +58 -134
  102. package/dist/lib/http.js +352 -271
  103. package/dist/lib/interrupt.d.ts +14 -8
  104. package/dist/lib/interrupt.js +28 -10
  105. package/dist/lib/junit-report.d.ts +60 -4
  106. package/dist/lib/junit-report.js +209 -32
  107. package/dist/lib/local-target.d.ts +3 -3
  108. package/dist/lib/local-target.js +3 -3
  109. package/dist/lib/output.d.ts +0 -29
  110. package/dist/lib/output.js +10 -33
  111. package/dist/lib/pagination.d.ts +2 -5
  112. package/dist/lib/pagination.js +2 -5
  113. package/dist/lib/presigned-url.d.ts +22 -0
  114. package/dist/lib/presigned-url.js +90 -0
  115. package/dist/lib/prompt.js +36 -2
  116. package/dist/lib/proxy.js +2 -1
  117. package/dist/lib/redact.d.ts +2 -2
  118. package/dist/lib/redact.js +3 -4
  119. package/dist/lib/removed-commands.d.ts +18 -0
  120. package/dist/lib/removed-commands.js +154 -0
  121. package/dist/lib/render-error.d.ts +31 -6
  122. package/dist/lib/render-error.js +88 -25
  123. package/dist/lib/response-schemas.d.ts +38 -30
  124. package/dist/lib/response-schemas.js +210 -207
  125. package/dist/lib/result/api.d.ts +24 -0
  126. package/dist/lib/result/api.js +28 -0
  127. package/dist/lib/result/evidence.d.ts +71 -0
  128. package/dist/lib/result/evidence.js +420 -0
  129. package/dist/lib/result/render.d.ts +20 -0
  130. package/dist/lib/result/render.js +194 -0
  131. package/dist/lib/result/types.d.ts +122 -0
  132. package/dist/lib/result/types.js +19 -0
  133. package/dist/lib/run-output.d.ts +275 -0
  134. package/dist/lib/run-output.js +227 -0
  135. package/dist/lib/run-render.d.ts +101 -0
  136. package/dist/lib/run-render.js +183 -0
  137. package/dist/lib/run-wait.d.ts +192 -0
  138. package/dist/lib/run-wait.js +452 -0
  139. package/dist/lib/runs.types.d.ts +134 -367
  140. package/dist/lib/runs.types.js +0 -14
  141. package/dist/lib/secret-file.d.ts +1 -1
  142. package/dist/lib/secret-file.js +11 -2
  143. package/dist/lib/skill-nudge.d.ts +7 -27
  144. package/dist/lib/skill-nudge.js +9 -37
  145. package/dist/lib/target-path.d.ts +15 -0
  146. package/dist/lib/target-path.js +35 -0
  147. package/dist/lib/target-url-advisory.d.ts +19 -0
  148. package/dist/lib/target-url-advisory.js +31 -0
  149. package/dist/lib/target-url-preflight.d.ts +9 -0
  150. package/dist/lib/target-url-preflight.js +214 -106
  151. package/dist/lib/target-url.d.ts +1 -1
  152. package/dist/lib/target-url.js +6 -16
  153. package/dist/lib/telemetry.d.ts +32 -12
  154. package/dist/lib/telemetry.js +39 -8
  155. package/dist/lib/terminal-text.d.ts +41 -0
  156. package/dist/lib/terminal-text.js +127 -0
  157. package/dist/lib/testlist.types.d.ts +16 -8
  158. package/dist/lib/testlist.types.js +1 -1
  159. package/dist/lib/text-equality.d.ts +2 -0
  160. package/dist/lib/text-equality.js +5 -0
  161. package/dist/lib/text-file.d.ts +16 -0
  162. package/dist/lib/text-file.js +41 -0
  163. package/dist/lib/text-table.d.ts +46 -0
  164. package/dist/lib/text-table.js +72 -4
  165. package/dist/lib/ticker.d.ts +9 -2
  166. package/dist/lib/ticker.js +16 -3
  167. package/dist/lib/transport-failure.d.ts +22 -0
  168. package/dist/lib/transport-failure.js +126 -0
  169. package/dist/lib/tunnel-session.d.ts +7 -1
  170. package/dist/lib/tunnel-session.js +22 -9
  171. package/dist/lib/update-check.js +3 -2
  172. package/dist/lib/url-template.d.ts +43 -0
  173. package/dist/lib/url-template.js +151 -0
  174. package/dist/lib/validate.d.ts +0 -64
  175. package/dist/lib/validate.js +2 -131
  176. package/dist/lib/version-notice.js +4 -3
  177. package/dist/lib/wait-exit.d.ts +37 -2
  178. package/dist/lib/wait-exit.js +88 -30
  179. package/dist/lib/workspace-status.js +10 -2
  180. package/dist/version.d.ts +1 -1
  181. package/dist/version.js +1 -1
  182. package/package.json +3 -4
  183. package/skills/testsprite-ci.skill.md +48 -18
  184. package/skills/testsprite-onboard.skill.md +66 -151
  185. package/skills/testsprite-verify.codex.md +54 -56
  186. package/skills/testsprite-verify.skill.md +194 -358
  187. package/dist/lib/browser.d.ts +0 -6
  188. package/dist/lib/browser.js +0 -54
  189. package/dist/lib/bundle.d.ts +0 -234
  190. package/dist/lib/bundle.js +0 -781
  191. package/dist/lib/deprecate.d.ts +0 -10
  192. package/dist/lib/deprecate.js +0 -13
  193. package/dist/lib/flaky.d.ts +0 -91
  194. package/dist/lib/flaky.js +0 -71
  195. package/dist/lib/plan-poll.d.ts +0 -171
  196. package/dist/lib/plan-poll.js +0 -441
  197. package/dist/lib/plans.types.d.ts +0 -130
  198. package/dist/lib/plans.types.js +0 -31
  199. package/dist/lib/poll.d.ts +0 -100
  200. package/dist/lib/poll.js +0 -290
  201. package/dist/lib/rate-throttle.d.ts +0 -49
  202. package/dist/lib/rate-throttle.js +0 -75
  203. package/dist/lib/run-progress.d.ts +0 -41
  204. package/dist/lib/run-progress.js +0 -56
  205. package/dist/lib/v3-advisory.d.ts +0 -55
  206. package/dist/lib/v3-advisory.js +0 -74
  207. package/schemas/plan.schema.json +0 -61
@@ -4,7 +4,7 @@
4
4
  * Termination signals: without a handler, Node terminates the process abruptly
5
5
  * with no output, so a user (Ctrl+C), a CI runner or `docker stop` (SIGTERM), or
6
6
  * a closed terminal/SSH session (SIGHUP) that interrupts a long
7
- * `test run --wait` is left unsure whether the run was cancelled or is still
7
+ * `run --wait` is left unsure whether the run was cancelled or is still
8
8
  * executing server-side (it is: the CLI only polls; the run lives on the
9
9
  * backend). The handler prints a one-line explanation plus how to resume, then
10
10
  * exits with the conventional `128 + signal` code.
@@ -12,10 +12,11 @@
12
12
  * Broken pipe: when output is piped to a reader that closes early
13
13
  * (`testsprite ... | head`), the kernel raises `EPIPE` on the next stdout write.
14
14
  * Node turns an `'error'` with no listener into an uncaughtException and dumps a
15
- * raw `write EPIPE` stack (exit 1). Outside an armed lifetime the guard exits
16
- * 0 immediately, the conventional SIGPIPE-equivalent result. While armed it
17
- * first requests coordinated shutdown so tunnel cleanup can finish, then the
18
- * same synthetic interrupt reason preserves exit 0.
15
+ * raw `write EPIPE` stack (exit 1). Outside an armed lifetime the guard lets
16
+ * the command settle so its own exit code (a failing verdict included) stands,
17
+ * with a backstop exit for a process left idle; a clean result still exits 0.
18
+ * While armed it first requests coordinated shutdown so tunnel cleanup can
19
+ * finish, then the same synthetic interrupt reason preserves exit 0.
19
20
  *
20
21
  * `process` and the streams are injectable so the wiring is unit-testable
21
22
  * without spawning a subprocess or sending a real signal.
@@ -49,7 +50,7 @@ export interface ShutdownHandle {
49
50
  * Two modes, chosen by whether a graceful-detach scope is armed when the
50
51
  * signal arrives:
51
52
  *
52
- * - **Armed** (inside `pollRunUntilTerminal` or a tunnel lifetime): the handler only aborts
53
+ * - **Armed** (inside `waitForRun` or a tunnel lifetime): the handler only aborts
53
54
  * `signal` with an `InterruptError` — no I/O, no exit. The in-flight fetch
54
55
  * and every backoff sleep bail immediately; the `--wait` catch blocks own
55
56
  * the cleanup (finalize the ticker, print the honest partial envelope +
@@ -138,12 +139,17 @@ export interface BrokenPipeDeps {
138
139
  exit?: (code: number) => void;
139
140
  /** Shutdown coordinator. Defaults to {@link globalShutdown}. */
140
141
  shutdown?: ShutdownController;
142
+ /** Backstop timer. Defaults to `setTimeout`. */
143
+ setTimer?: (callback: () => void, delayMs: number) => Pick<NodeJS.Timeout, 'unref'>;
144
+ /** The exit code set so far. Defaults to reading `process.exitCode`. */
145
+ exitCode?: () => number | string | null | undefined;
141
146
  }
142
147
  /**
143
148
  * Guard against `EPIPE` on stdout/stderr so piping to a reader that closes
144
149
  * early (`testsprite ... | head`) exits cleanly instead of crashing with an
145
150
  * unhandled `write EPIPE` stack. An armed stdout path requests graceful
146
- * shutdown before exiting 0; a disarmed one exits 0 immediately. Only `EPIPE`
147
- * is swallowed; any other stream error is left to surface normally.
151
+ * shutdown before exiting 0; a disarmed one leaves the exit code to the
152
+ * command and only arms a backstop. Only `EPIPE` is swallowed; any other
153
+ * stream error is left to surface normally.
148
154
  */
149
155
  export declare function installBrokenPipeGuard(deps?: BrokenPipeDeps): void;
@@ -4,7 +4,7 @@
4
4
  * Termination signals: without a handler, Node terminates the process abruptly
5
5
  * with no output, so a user (Ctrl+C), a CI runner or `docker stop` (SIGTERM), or
6
6
  * a closed terminal/SSH session (SIGHUP) that interrupts a long
7
- * `test run --wait` is left unsure whether the run was cancelled or is still
7
+ * `run --wait` is left unsure whether the run was cancelled or is still
8
8
  * executing server-side (it is: the CLI only polls; the run lives on the
9
9
  * backend). The handler prints a one-line explanation plus how to resume, then
10
10
  * exits with the conventional `128 + signal` code.
@@ -12,10 +12,11 @@
12
12
  * Broken pipe: when output is piped to a reader that closes early
13
13
  * (`testsprite ... | head`), the kernel raises `EPIPE` on the next stdout write.
14
14
  * Node turns an `'error'` with no listener into an uncaughtException and dumps a
15
- * raw `write EPIPE` stack (exit 1). Outside an armed lifetime the guard exits
16
- * 0 immediately, the conventional SIGPIPE-equivalent result. While armed it
17
- * first requests coordinated shutdown so tunnel cleanup can finish, then the
18
- * same synthetic interrupt reason preserves exit 0.
15
+ * raw `write EPIPE` stack (exit 1). Outside an armed lifetime the guard lets
16
+ * the command settle so its own exit code (a failing verdict included) stands,
17
+ * with a backstop exit for a process left idle; a clean result still exits 0.
18
+ * While armed it first requests coordinated shutdown so tunnel cleanup can
19
+ * finish, then the same synthetic interrupt reason preserves exit 0.
19
20
  *
20
21
  * `process` and the streams are injectable so the wiring is unit-testable
21
22
  * without spawning a subprocess or sending a real signal.
@@ -38,7 +39,7 @@ export function armInterruptExitBackstop(code, deps = {}) {
38
39
  * Two modes, chosen by whether a graceful-detach scope is armed when the
39
40
  * signal arrives:
40
41
  *
41
- * - **Armed** (inside `pollRunUntilTerminal` or a tunnel lifetime): the handler only aborts
42
+ * - **Armed** (inside `waitForRun` or a tunnel lifetime): the handler only aborts
42
43
  * `signal` with an `InterruptError` — no I/O, no exit. The in-flight fetch
43
44
  * and every backoff sleep bail immediately; the `--wait` catch blocks own
44
45
  * the cleanup (finalize the ticker, print the honest partial envelope +
@@ -146,7 +147,9 @@ class BrokenPipeInterruptError extends InterruptError {
146
147
  export const globalShutdown = new ShutdownController();
147
148
  export function formatInterruptMessage(signal = 'SIGINT') {
148
149
  return (`Interrupted (${signal}). Any run already started keeps executing on the server; ` +
149
- 'check it with `testsprite test list` or `testsprite test wait <runId>`.');
150
+ 'check it with `testsprite run wait <run-id>` or `testsprite result list --run <run-id>`, ' +
151
+ // This line is printed before a command had a run id to print, usually.
152
+ 'or, with no run id printed yet, find it with `testsprite result list --test <test-id>`.');
150
153
  }
151
154
  const CRITICAL_OPERATION_GRACE_MS = 2_000;
152
155
  /** How often the grace period re-checks whether tracked work is still running. */
@@ -272,14 +275,18 @@ export function installSignalHandlers(deps = {}) {
272
275
  * Guard against `EPIPE` on stdout/stderr so piping to a reader that closes
273
276
  * early (`testsprite ... | head`) exits cleanly instead of crashing with an
274
277
  * unhandled `write EPIPE` stack. An armed stdout path requests graceful
275
- * shutdown before exiting 0; a disarmed one exits 0 immediately. Only `EPIPE`
276
- * is swallowed; any other stream error is left to surface normally.
278
+ * shutdown before exiting 0; a disarmed one leaves the exit code to the
279
+ * command and only arms a backstop. Only `EPIPE` is swallowed; any other
280
+ * stream error is left to surface normally.
277
281
  */
278
282
  export function installBrokenPipeGuard(deps = {}) {
279
283
  const stdout = deps.stdout ?? process.stdout;
280
284
  const stderr = deps.stderr ?? process.stderr;
281
285
  const exit = deps.exit ?? ((code) => process.exit(code));
282
286
  const shutdown = deps.shutdown ?? globalShutdown;
287
+ const setTimer = deps.setTimer ?? setTimeout;
288
+ const exitCode = deps.exitCode ?? (() => process.exitCode);
289
+ let backstopArmed = false;
283
290
  stdout.on('error', (error) => {
284
291
  // Reader went away (`| head`, `| less` then q): exit cleanly like SIGPIPE
285
292
  // rather than dumping an unhandled `write EPIPE` stack. Any other stdout
@@ -292,7 +299,18 @@ export function installBrokenPipeGuard(deps = {}) {
292
299
  shutdown.brokenPipe();
293
300
  return;
294
301
  }
295
- exit(0);
302
+ // Exiting here would race index.ts, which sets a failing verdict's exit
303
+ // code only after an async telemetry flush, and turn it into 0. Let the
304
+ // command settle; once the event loop drains the process exits with the
305
+ // code it set. The unref'd backstop only fires when something keeps the
306
+ // process alive (an idle prompt, a stdout `drain` that never comes).
307
+ if (backstopArmed)
308
+ return;
309
+ backstopArmed = true;
310
+ setTimer(() => {
311
+ const code = Number(exitCode() ?? 0);
312
+ exit(Number.isInteger(code) ? code : 0);
313
+ }, INTERRUPT_EXIT_BACKSTOP_MS).unref();
296
314
  return;
297
315
  }
298
316
  throw error;
@@ -1,12 +1,20 @@
1
- import { type CiSummary } from './gh-output.js';
1
+ import { type CiRunRow, type CiSummary } from './gh-output.js';
2
2
  export type JUnitReportFormat = 'junit';
3
- /** Minimal testcase input shared by batch run and batch rerun poll results. */
3
+ /** Minimal testcase input shared by the batch `run` and `run --testlist` poll results. */
4
4
  export interface JUnitTestResult {
5
5
  testId: string;
6
+ /** The result id (wire name); the `resultId` attribute of the testcase. */
7
+ resultId?: string;
8
+ /**
9
+ * The launch the result belongs to (wire name). When every case that names
10
+ * a result shares it, it is the `resultId` attribute of the testsuite.
11
+ */
6
12
  runId?: string;
7
13
  status: string;
8
14
  /** Observed on polled runs; used for classname when --project is omitted. */
9
15
  projectId?: string;
16
+ /** This row's own `classname`, when the batch spans several projects. */
17
+ classname?: string;
10
18
  error?: {
11
19
  code: string;
12
20
  message: string;
@@ -43,7 +51,7 @@ export interface JUnitReportFlagOptions {
43
51
  reportFile?: string;
44
52
  reportSuiteName?: string;
45
53
  wait: boolean;
46
- /** True when the invocation is a batch path (run --all or rerun batch). */
54
+ /** True when the invocation is a batch path (a project or several named IDs). */
47
55
  batchPath: boolean;
48
56
  }
49
57
  /**
@@ -61,6 +69,7 @@ export declare function assertJUnitReportOptions(opts: JUnitReportFlagOptions):
61
69
  */
62
70
  export declare function resolveBatchReportProjectId(opts: {
63
71
  projectId?: string;
72
+ projectIdByTestId?: ReadonlyMap<string, string>;
64
73
  }, results: ReadonlyArray<{
65
74
  projectId?: string;
66
75
  }>): string;
@@ -72,11 +81,29 @@ export declare function escapeXml(text: string): string;
72
81
  * Build a JUnit XML document from batch results, including skipped members. Per-`testcase` `time` is
73
82
  * the run's wall-clock duration (from `startedAt`/`finishedAt`); the `testsuite`
74
83
  * `time` is their sum. `time` falls back to `0` for a run with no timing.
84
+ *
85
+ * A testcase carries the `resultId` it names. The testsuite carries `resultId`:
86
+ * the launch the testcases that ran here share, and only when every testcase
87
+ * that names a result, skipped ones included, belongs to it too. So a suite
88
+ * with a skipped test another run holds, one whose tests ran in several
89
+ * launches, one where nothing ran (all of it held by an earlier run), or one
90
+ * from a backend that names no launch, carries none. A test this invocation
91
+ * joined (already running, then waited on) ran here, so a batch that only
92
+ * joined one run names that run. A test that never got a result names no
93
+ * launch and does not count.
75
94
  */
76
95
  export declare function buildJUnitReport(opts: JUnitReportBuildOptions): string;
96
+ /**
97
+ * One non-dispatched summary row as a skipped JUnit result, with its reason
98
+ * (or its status when it has none). A test another run already holds keeps
99
+ * that run's result and launch.
100
+ */
101
+ export declare function skippedRowFromSummary(row: CiRunRow): JUnitTestResult;
77
102
  /**
78
103
  * The summary's non-dispatched rows (deferred / conflict / not-found) as
79
- * skipped JUnit results. Accepted rows carry run statuses and today never
104
+ * skipped JUnit results. A test another run already holds names that run's
105
+ * result and launch, so the suite does not name its launch as this
106
+ * invocation's run (see `buildJUnitReport`). Accepted rows carry run statuses and today never
80
107
  * match `isNonDispatchedStatus`, but the two vocabularies are only disjoint
81
108
  * by convention: `skipped` is a word both could use. So a member already in
82
109
  * `dispatched` (the polled results the caller is writing) is left out here
@@ -84,7 +111,36 @@ export declare function buildJUnitReport(opts: JUnitReportBuildOptions): string;
84
111
  * member twice if the server ever reports such a status for an admitted run.
85
112
  */
86
113
  export declare function skippedJUnitResultsFromSummary(summary: CiSummary, dispatched?: ReadonlyArray<Pick<JUnitTestResult, 'testId'>>): JUnitTestResult[];
114
+ /**
115
+ * The summary's rows as the report of a batch that stopped before its runs
116
+ * were awaited: a test that never dispatched is skipped with its reason, and
117
+ * every other row is an error with its own note, or `failure` when it has
118
+ * none. Each row keeps its result and launch.
119
+ */
120
+ export declare function junitRowsFromSummary(summary: CiSummary, failure: string): JUnitTestResult[];
121
+ /**
122
+ * Check that an output artifact path (`--report-file`, `--summary-file`) can be
123
+ * written: non-empty, not a directory, and inside an existing directory.
124
+ * Returns the resolved absolute path.
125
+ *
126
+ * Called in each command's pre-flight, before anything is dispatched or billed,
127
+ * so a mistyped directory fails fast with exit 5 instead of surfacing only after
128
+ * a full batch has run. The write itself re-checks (the directory can vanish in
129
+ * between).
130
+ */
131
+ export declare function assertArtifactPath(field: 'report-file' | 'summary-file', rawPath: string): string;
87
132
  /**
88
133
  * Atomically write JUnit XML to `--report-file` (temp sibling + rename).
89
134
  */
90
135
  export declare function writeJUnitReportFile(rawPath: string, xml: string): Promise<void>;
136
+ /**
137
+ * Write a run's JUnit report (`write`) when the command may already owe an
138
+ * exit: a failed or timed-out test, one not dispatched, a refused request.
139
+ * Then the report is best-effort: one that cannot be written (its directory
140
+ * gone, say) is a line on stderr and the exit owed stands. With nothing owed,
141
+ * the write's error is the command's. An interrupt always propagates.
142
+ */
143
+ export declare function writeReportOwing(owesAnExit: boolean, write: () => Promise<void>, stderr: (line: string) => void, context: {
144
+ label: string;
145
+ what?: string;
146
+ }): Promise<void>;
@@ -1,9 +1,10 @@
1
- import { createWriteStream } from 'node:fs';
2
- import { rename, stat, unlink } from 'node:fs/promises';
1
+ import { createWriteStream, statSync } from 'node:fs';
2
+ import { rename, unlink } from 'node:fs/promises';
3
3
  import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
4
4
  import { randomUUID } from 'node:crypto';
5
- import { localValidationError, TransportError } from './errors.js';
5
+ import { InterruptError, localValidationError, TransportError } from './errors.js';
6
6
  import { isNonDispatchedStatus } from './gh-output.js';
7
+ import { sharedLaunchId } from './run-render.js';
7
8
  /**
8
9
  * Duration in seconds between two ISO timestamps, or `undefined` when either is
9
10
  * missing / unparseable / negative (clock skew). Prefer startedAt, falling back
@@ -52,7 +53,7 @@ export function assertJUnitReportOptions(opts) {
52
53
  return;
53
54
  }
54
55
  if (!opts.batchPath) {
55
- throw localValidationError('report', '--report junit only applies to batch --wait runs (test run --all, or test rerun --all / multiple test ids)');
56
+ throw localValidationError('report', '--report junit only applies to batch --wait runs (run --project, or multiple test ids)');
56
57
  }
57
58
  if (!opts.wait) {
58
59
  throw localValidationError('report', '--report junit requires --wait (the report is written after batch polling completes)');
@@ -68,16 +69,34 @@ export function assertJUnitReportOptions(opts) {
68
69
  export function resolveBatchReportProjectId(opts, results) {
69
70
  if (opts.projectId)
70
71
  return opts.projectId;
72
+ // Explicit ids that span several projects have no single `--project`; each
73
+ // row carries its own project as its classname and the suite gets this token.
74
+ const known = new Set(opts.projectIdByTestId?.values());
75
+ if (known.size > 1)
76
+ return 'multiple-projects';
71
77
  const fromPoll = results.map(r => r.projectId).find((id) => !!id);
72
78
  if (fromPoll)
73
79
  return fromPoll;
80
+ if (known.size === 1)
81
+ return [...known][0];
74
82
  throw localValidationError('project', '--report junit requires --project <id> when the project cannot be inferred from run results');
75
83
  }
84
+ /**
85
+ * Characters XML 1.0 forbids anywhere in a document: the `Char` production
86
+ * allows only #x9, #xA, #xD, [#x20-#xD7FF], [#xE000-#xFFFD] and
87
+ * [#x10000-#x10FFFF]. No entity can represent the excluded characters, so
88
+ * they are stripped rather than escaped — a single one in a free-text run
89
+ * message (LLM / server supplied) makes strict parsers reject the whole
90
+ * report. Tab, newline and carriage return are legal and preserved.
91
+ */
92
+ // eslint-disable-next-line no-control-regex
93
+ const XML_1_0_ILLEGAL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]/g;
76
94
  /**
77
95
  * Escape text for inclusion in XML element bodies and double-quoted attributes.
78
96
  */
79
97
  export function escapeXml(text) {
80
98
  return text
99
+ .replace(XML_1_0_ILLEGAL_CHARS, '')
81
100
  .replace(/&/g, '&amp;')
82
101
  .replace(/</g, '&lt;')
83
102
  .replace(/>/g, '&gt;')
@@ -87,7 +106,7 @@ export function escapeXml(text) {
87
106
  function classifyJUnitOutcome(status, error) {
88
107
  if (status === 'passed')
89
108
  return 'passed';
90
- if (isNonDispatchedStatus(status))
109
+ if (status === 'running' || isNonDispatchedStatus(status))
91
110
  return 'skipped';
92
111
  if (status === 'error' || error?.exitCode === 3)
93
112
  return 'error';
@@ -100,25 +119,30 @@ function failureMessage(result) {
100
119
  return result.error.code;
101
120
  return result.status;
102
121
  }
103
- function renderTestcase(result, classname) {
122
+ function renderTestcase(result, classname, displayName) {
104
123
  const outcome = classifyJUnitOutcome(result.status, result.error);
105
124
  // A readable CI test tab keys on `name`: prefer the human test name, fall back
106
125
  // to the id. The UUID is preserved as a `testId` attribute (ignored by
107
126
  // renderers, read by machine consumers) so the switch loses no information.
108
- const name = escapeXml(result.name?.trim() || result.testId);
127
+ // `displayName` carries the precomputed disambiguated name for colliding
128
+ // groups (see resolveJUnitDisplayNames).
129
+ const name = escapeXml(displayName ?? (result.name?.trim() || result.testId));
109
130
  const cls = escapeXml(classname);
110
131
  const time = formatTime(result.durationSeconds);
111
132
  const idAttr = ` testId="${escapeXml(result.testId)}"`;
112
- const runAttr = result.runId ? ` runId="${escapeXml(result.runId)}"` : '';
133
+ // The testcase names its own result. Its launch is the suite's, when the
134
+ // suite has one.
135
+ const { resultId } = { resultId: result.resultId };
136
+ const resultAttr = resultId ? ` resultId="${escapeXml(resultId)}"` : '';
113
137
  const lines = [
114
- ` <testcase classname="${cls}" name="${name}"${idAttr}${runAttr} time="${time}">`,
138
+ ` <testcase classname="${cls}" name="${name}"${idAttr}${resultAttr} time="${time}">`,
115
139
  ];
116
140
  if (outcome === 'failure') {
117
141
  const message = escapeXml(failureMessage(result));
118
142
  const type = escapeXml(result.status);
119
143
  const body = escapeXml([
120
144
  `status: ${result.status}`,
121
- result.runId ? `runId: ${result.runId}` : undefined,
145
+ resultId ? `resultId: ${resultId}` : undefined,
122
146
  result.error?.code ? `code: ${result.error.code}` : undefined,
123
147
  result.error?.message ? `message: ${result.error.message}` : undefined,
124
148
  ]
@@ -132,22 +156,89 @@ function renderTestcase(result, classname) {
132
156
  const body = escapeXml([
133
157
  result.error?.code ? `code: ${result.error.code}` : undefined,
134
158
  result.error?.message ? `message: ${result.error.message}` : undefined,
135
- result.runId ? `runId: ${result.runId}` : undefined,
159
+ resultId ? `resultId: ${resultId}` : undefined,
136
160
  ]
137
161
  .filter(Boolean)
138
162
  .join('\n'));
139
163
  lines.push(` <error message="${message}" type="${type}">${body}</error>`);
140
164
  }
141
165
  else if (outcome === 'skipped') {
142
- lines.push(` <skipped message="${escapeXml(result.skipReason ?? failureMessage(result))}"/>`);
166
+ const reason = result.status === 'running'
167
+ ? 'Still running when the wait ended'
168
+ : (result.skipReason ?? failureMessage(result));
169
+ lines.push(` <skipped message="${escapeXml(reason)}"/>`);
143
170
  }
144
171
  lines.push(' </testcase>');
145
172
  return lines.join('\n');
146
173
  }
174
+ /**
175
+ * Standard JUnit consumers (GitLab, Jenkins) key a testcase on classname+name
176
+ * and ignore extra attributes, so rows sharing both collapse into one — a
177
+ * same-name pair from a multi-project list then loses one verdict and one
178
+ * run's diagnostics (#515). The stable logical testId — not the ephemeral
179
+ * result id, which would break cross-run comparison — joins the standard identity
180
+ * for colliding groups only: unique names render exactly as before.
181
+ */
182
+ function resolveJUnitDisplayNames(results, fallbackClassname) {
183
+ const rawNames = results.map(result => result.name?.trim() || result.testId);
184
+ const names = [...rawNames];
185
+ // XML consumers normalize attribute whitespace: line endings collapse first
186
+ // (CRLF/CR → LF), then tabs/newlines/carriage returns each become a space.
187
+ // Raw-distinct names can therefore share an identity downstream, so the
188
+ // collision keys use the normalized form; rendering keeps the original text.
189
+ const attributeKey = (value) => value.replace(/\r\n?/g, '\n').replace(/[\n\t]/g, ' ');
190
+ const keyOf = (classname, name) => `${attributeKey(classname)}\u0000${attributeKey(name)}`;
191
+ // The suffix must stay injective under attributeKey normalization, or two raw-distinct
192
+ // ids ("a\tb" vs "a b") re-collide after suffixing and the round cap gives up leaving
193
+ // duplicate identities. JSON-escaping (minus the surrounding quotes) encodes control
194
+ // characters as visible two-char escapes, so distinct ids render distinct suffixes
195
+ // that normalization cannot fold; ids without escapes render unchanged.
196
+ const displayTestId = (testId) => JSON.stringify(testId).slice(1, -1);
197
+ // Suffixing can itself collide with a row whose human title already looks
198
+ // like a suffixed one ("Checkout [case-a]" as a literal name), so iterate
199
+ // until no (classname, name) pair collides. Each round's colliding set gets
200
+ // an injective encoded suffix, so the set ends pairwise distinct and the
201
+ // loop terminates. A group whose rows all share one testId can never be
202
+ // separated by any suffix — the rows are exact duplicates — so it is left
203
+ // alone instead of spinning to the round cap (run --testlist can pass the
204
+ // same id twice, billing each row).
205
+ for (let round = 0; round <= results.length; round++) {
206
+ const groups = new Map();
207
+ results.forEach((result, index) => {
208
+ const key = keyOf(result.classname ?? fallbackClassname, names[index]);
209
+ const group = groups.get(key) ?? { count: 0, testIds: new Set() };
210
+ group.count += 1;
211
+ group.testIds.add(result.testId);
212
+ groups.set(key, group);
213
+ });
214
+ let changed = false;
215
+ results.forEach((result, index) => {
216
+ const key = keyOf(result.classname ?? fallbackClassname, names[index]);
217
+ const group = groups.get(key);
218
+ if (group.count > 1 && group.testIds.size > 1) {
219
+ names[index] = `${names[index]} [${displayTestId(result.testId)}]`;
220
+ changed = true;
221
+ }
222
+ });
223
+ if (!changed)
224
+ break;
225
+ }
226
+ return names.map((name, index) => (name === rawNames[index] ? undefined : name));
227
+ }
147
228
  /**
148
229
  * Build a JUnit XML document from batch results, including skipped members. Per-`testcase` `time` is
149
230
  * the run's wall-clock duration (from `startedAt`/`finishedAt`); the `testsuite`
150
231
  * `time` is their sum. `time` falls back to `0` for a run with no timing.
232
+ *
233
+ * A testcase carries the `resultId` it names. The testsuite carries `resultId`:
234
+ * the launch the testcases that ran here share, and only when every testcase
235
+ * that names a result, skipped ones included, belongs to it too. So a suite
236
+ * with a skipped test another run holds, one whose tests ran in several
237
+ * launches, one where nothing ran (all of it held by an earlier run), or one
238
+ * from a backend that names no launch, carries none. A test this invocation
239
+ * joined (already running, then waited on) ran here, so a batch that only
240
+ * joined one run names that run. A test that never got a result names no
241
+ * launch and does not count.
151
242
  */
152
243
  export function buildJUnitReport(opts) {
153
244
  const results = opts.results;
@@ -168,20 +259,44 @@ export function buildJUnitReport(opts) {
168
259
  }
169
260
  }
170
261
  const suiteName = escapeXml(opts.suiteName);
171
- const testcases = results.map(r => renderTestcase(r, opts.classname)).join('\n');
262
+ // The run this invocation's tests ran in, and only when no testcase, skipped
263
+ // ones included, names a result of another run.
264
+ const own = sharedLaunchId(results.filter(result => !isNonDispatchedStatus(result.status)));
265
+ const launchId = own !== undefined && sharedLaunchId(results) === own ? own : undefined;
266
+ const runAttr = launchId !== undefined ? ` runId="${escapeXml(launchId)}"` : '';
267
+ const displayNames = resolveJUnitDisplayNames(results, opts.classname);
268
+ const testcases = results
269
+ .map((r, index) => renderTestcase(r, r.classname ?? opts.classname, displayNames[index]))
270
+ .join('\n');
172
271
  return [
173
272
  XML_DECL,
174
273
  '<testsuites>',
175
- ` <testsuite name="${suiteName}" tests="${results.length}" failures="${failures}" errors="${errors}" skipped="${skipped}" time="${formatTime(totalSeconds)}">`,
274
+ ` <testsuite name="${suiteName}"${runAttr} tests="${results.length}" failures="${failures}" errors="${errors}" skipped="${skipped}" time="${formatTime(totalSeconds)}">`,
176
275
  testcases,
177
276
  ' </testsuite>',
178
277
  '</testsuites>',
179
278
  '',
180
279
  ].join('\n');
181
280
  }
281
+ /**
282
+ * One non-dispatched summary row as a skipped JUnit result, with its reason
283
+ * (or its status when it has none). A test another run already holds keeps
284
+ * that run's result and launch.
285
+ */
286
+ export function skippedRowFromSummary(row) {
287
+ return {
288
+ testId: row.testId ?? row.resultId ?? row.runId ?? '(unknown)',
289
+ ...(row.resultId !== undefined ? { resultId: row.resultId } : {}),
290
+ ...(row.runId !== undefined ? { runId: row.runId } : {}),
291
+ status: 'skipped',
292
+ skipReason: row.error ?? row.status,
293
+ };
294
+ }
182
295
  /**
183
296
  * The summary's non-dispatched rows (deferred / conflict / not-found) as
184
- * skipped JUnit results. Accepted rows carry run statuses and today never
297
+ * skipped JUnit results. A test another run already holds names that run's
298
+ * result and launch, so the suite does not name its launch as this
299
+ * invocation's run (see `buildJUnitReport`). Accepted rows carry run statuses and today never
185
300
  * match `isNonDispatchedStatus`, but the two vocabularies are only disjoint
186
301
  * by convention: `skipped` is a word both could use. So a member already in
187
302
  * `dispatched` (the polled results the caller is writing) is left out here
@@ -190,38 +305,80 @@ export function buildJUnitReport(opts) {
190
305
  */
191
306
  export function skippedJUnitResultsFromSummary(summary, dispatched = []) {
192
307
  const alreadyIncluded = new Set(dispatched.map(row => row.testId));
193
- return summary.runs
194
- .filter(row => isNonDispatchedStatus(row.status) && !alreadyIncluded.has(row.testId))
195
- .map(row => ({ testId: row.testId, status: 'skipped', skipReason: row.error ?? row.status }));
308
+ return summary.results
309
+ .filter(row => isNonDispatchedStatus(row.status) && (!row.testId || !alreadyIncluded.has(row.testId)))
310
+ .map(skippedRowFromSummary);
311
+ }
312
+ /**
313
+ * The summary's rows as the report of a batch that stopped before its runs
314
+ * were awaited: a test that never dispatched is skipped with its reason, and
315
+ * every other row is an error with its own note, or `failure` when it has
316
+ * none. Each row keeps its result and launch.
317
+ */
318
+ export function junitRowsFromSummary(summary, failure) {
319
+ return summary.results.map(row => isNonDispatchedStatus(row.status)
320
+ ? skippedRowFromSummary(row)
321
+ : {
322
+ testId: row.testId ?? row.resultId ?? row.runId ?? '(unknown)',
323
+ ...(row.resultId !== undefined ? { resultId: row.resultId } : {}),
324
+ ...(row.runId !== undefined ? { runId: row.runId } : {}),
325
+ status: 'error',
326
+ error: { code: 'UNSUPPORTED', message: row.error ?? failure, exitCode: 7 },
327
+ });
328
+ }
329
+ function errorCode(err) {
330
+ return err?.code ?? 'unknown error';
331
+ }
332
+ function isAbsentPathError(err) {
333
+ const code = errorCode(err);
334
+ return code === 'ENOENT' || code === 'ENOTDIR';
196
335
  }
197
- async function assertReportFileParent(rawPath) {
336
+ /**
337
+ * Check that an output artifact path (`--report-file`, `--summary-file`) can be
338
+ * written: non-empty, not a directory, and inside an existing directory.
339
+ * Returns the resolved absolute path.
340
+ *
341
+ * Called in each command's pre-flight, before anything is dispatched or billed,
342
+ * so a mistyped directory fails fast with exit 5 instead of surfacing only after
343
+ * a full batch has run. The write itself re-checks (the directory can vanish in
344
+ * between).
345
+ */
346
+ export function assertArtifactPath(field, rawPath) {
198
347
  if (typeof rawPath !== 'string' || rawPath.length === 0) {
199
- throw localValidationError('report-file', 'must be a non-empty file path');
348
+ throw localValidationError(field, 'must be a non-empty file path');
200
349
  }
201
- const resolved = isAbsolute(rawPath) ? rawPath : resolve(process.cwd(), rawPath);
202
- if (resolved.endsWith('/') || resolved.endsWith('\\')) {
203
- throw localValidationError('report-file', 'must point to a file, not a directory');
350
+ if (/[\\/]$/.test(rawPath)) {
351
+ throw localValidationError(field, 'must point to a file, not a directory');
204
352
  }
353
+ const resolved = isAbsolute(rawPath) ? rawPath : resolve(process.cwd(), rawPath);
205
354
  const parent = dirname(resolved);
206
355
  let parentStat;
207
356
  try {
208
- parentStat = await stat(parent);
357
+ // eslint-disable-next-line security/detect-non-literal-fs-filename -- inspect the user-selected artifact parent before dispatch; no file content is read.
358
+ parentStat = statSync(parent);
209
359
  }
210
- catch {
211
- throw localValidationError('report-file', `parent directory does not exist: ${parent}`);
360
+ catch (err) {
361
+ if (isAbsentPathError(err))
362
+ throw localValidationError(field, `parent directory does not exist: ${parent}`);
363
+ throw localValidationError(field, `cannot access parent directory ${parent}: ${errorCode(err)}`);
212
364
  }
213
365
  if (!parentStat.isDirectory()) {
214
- throw localValidationError('report-file', `parent path is not a directory: ${parent}`);
366
+ throw localValidationError(field, `parent path is not a directory: ${parent}`);
215
367
  }
216
368
  let targetStat;
217
369
  try {
218
- targetStat = await stat(resolved);
370
+ // eslint-disable-next-line security/detect-non-literal-fs-filename -- inspect the user-selected artifact target to reject directories and inaccessible paths before dispatch.
371
+ targetStat = statSync(resolved);
219
372
  }
220
- catch {
221
- return resolved;
373
+ catch (err) {
374
+ // Only a missing target is fine (it will be created); anything else (EACCES, ELOOP...) would fail the
375
+ // write after the run was dispatched, which is exactly what this pre-flight exists to prevent.
376
+ if (isAbsentPathError(err))
377
+ return resolved;
378
+ throw localValidationError(field, `cannot access ${resolved}: ${errorCode(err)}`);
222
379
  }
223
380
  if (targetStat.isDirectory()) {
224
- throw localValidationError('report-file', `must point to a file, not a directory: ${resolved}`);
381
+ throw localValidationError(field, `must point to a file, not a directory: ${resolved}`);
225
382
  }
226
383
  return resolved;
227
384
  }
@@ -229,7 +386,7 @@ async function assertReportFileParent(rawPath) {
229
386
  * Atomically write JUnit XML to `--report-file` (temp sibling + rename).
230
387
  */
231
388
  export async function writeJUnitReportFile(rawPath, xml) {
232
- const resolved = await assertReportFileParent(rawPath);
389
+ const resolved = assertArtifactPath('report-file', rawPath);
233
390
  const parent = dirname(resolved);
234
391
  const tmpPath = join(parent, `.${basename(resolved)}.tmp-${randomUUID()}`);
235
392
  await new Promise((resolvePromise, reject) => {
@@ -258,4 +415,24 @@ export async function writeJUnitReportFile(rawPath, xml) {
258
415
  });
259
416
  });
260
417
  }
418
+ /**
419
+ * Write a run's JUnit report (`write`) when the command may already owe an
420
+ * exit: a failed or timed-out test, one not dispatched, a refused request.
421
+ * Then the report is best-effort: one that cannot be written (its directory
422
+ * gone, say) is a line on stderr and the exit owed stands. With nothing owed,
423
+ * the write's error is the command's. An interrupt always propagates.
424
+ */
425
+ export async function writeReportOwing(owesAnExit, write, stderr, context) {
426
+ if (!owesAnExit)
427
+ return write();
428
+ try {
429
+ await write();
430
+ }
431
+ catch (err) {
432
+ if (err instanceof InterruptError)
433
+ throw err;
434
+ stderr(`[${context.label}] could not write ${context.what ?? 'the JUnit report'}: ` +
435
+ `${err instanceof Error ? err.message : String(err)}; continuing`);
436
+ }
437
+ }
261
438
  //# sourceMappingURL=junit-report.js.map
@@ -103,9 +103,9 @@ export declare function parseStoredLocalTarget(opts: {
103
103
  url?: string;
104
104
  }): StoredLocalTarget | undefined;
105
105
  /**
106
- * Refuse a stored-target write whose loopback port has nothing listening —
107
- * the same check `project create --local` runs, so a typo in the port is
108
- * caught before a row exists anywhere. `skipPreflight` is a pure no-op.
106
+ * Refuse a stored-target write (`project env create` / `project env update`
107
+ * with `--local`) whose loopback port has nothing listening, so a typo in the
108
+ * port is caught before a row exists anywhere. `skipPreflight` is a pure no-op.
109
109
  */
110
110
  export declare function assertStoredLocalTargetListening(target: StoredLocalTarget, opts: {
111
111
  skipPreflight?: boolean;
@@ -154,9 +154,9 @@ function flagPairError(message) {
154
154
  });
155
155
  }
156
156
  /**
157
- * Refuse a stored-target write whose loopback port has nothing listening —
158
- * the same check `project create --local` runs, so a typo in the port is
159
- * caught before a row exists anywhere. `skipPreflight` is a pure no-op.
157
+ * Refuse a stored-target write (`project env create` / `project env update`
158
+ * with `--local`) whose loopback port has nothing listening, so a typo in the
159
+ * port is caught before a row exists anywhere. `skipPreflight` is a pure no-op.
160
160
  */
161
161
  export async function assertStoredLocalTargetListening(target, opts, deps = {}) {
162
162
  if (opts.skipPreflight)