@cnc-tools/storm 0.13.0 → 0.14.1

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 (136) hide show
  1. package/dist/application.js +5 -1
  2. package/dist/bin/storm.js +6 -2
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/{chunk-N7E6DAUE.js → chunk-27P2QSIM.js} +1 -1
  5. package/dist/chunks/{chunk-ZDJLKF2G.js → chunk-5ED3IDUJ.js} +7 -4
  6. package/dist/chunks/{chunk-6EQKA7LI.js → chunk-5TMHYH7G.js} +1 -1
  7. package/dist/chunks/{chunk-AX4EQZUS.js → chunk-BFLYGMG3.js} +12 -7
  8. package/dist/chunks/{chunk-LQKNI3EG.js → chunk-BRUIATTR.js} +6 -6
  9. package/dist/chunks/{chunk-DOFB2ACU.js → chunk-HOKDKP5A.js} +1 -1
  10. package/dist/chunks/{chunk-EGNP3S6C.js → chunk-IVRRGGCD.js} +60 -20
  11. package/dist/chunks/{chunk-RTILVSYQ.js → chunk-QBR5VHJ7.js} +1 -1
  12. package/dist/chunks/{chunk-YT5OROR7.js → chunk-RA4L2ACU.js} +12 -2
  13. package/dist/chunks/{chunk-YGS5VRQT.js → chunk-RKONDLPS.js} +8 -5
  14. package/dist/chunks/{chunk-IYM44FUX.js → chunk-UC6DULWY.js} +2 -2
  15. package/dist/chunks/{chunk-2NZXL6OH.js → chunk-XPCUINWS.js} +1 -1
  16. package/dist/chunks/{chunk-Q4TKRILH.js → chunk-YBPTMJUM.js} +98 -21
  17. package/dist/chunks/{chunk-5UMJNVKT.js → chunk-Z5OXOZD3.js} +125 -83
  18. package/dist/chunks/{chunk-X4WBJIOF.js → chunk-ZH5R7W4A.js} +1 -1
  19. package/dist/chunks/{live-app-QFHS54SX.js → live-app-FBVWUUMT.js} +7 -7
  20. package/dist/commands/exec/command.d.ts +2 -0
  21. package/dist/commands/exec/command.js +15 -41
  22. package/dist/commands/exec/define-run-command.d.ts +17 -10
  23. package/dist/commands/exec/define-run-command.js +48 -15
  24. package/dist/commands/exec/driver-plan.d.ts +24 -16
  25. package/dist/commands/exec/driver-plan.js +34 -15
  26. package/dist/commands/exec/driver-refusals.js +7 -6
  27. package/dist/commands/exec/exec-words.d.ts +1 -1
  28. package/dist/commands/exec/exec-words.js +8 -2
  29. package/dist/commands/exec/final-results.d.ts +39 -0
  30. package/dist/commands/exec/final-results.js +29 -0
  31. package/dist/commands/exec/metadata.js +1 -1
  32. package/dist/commands/exec/outcomes.d.ts +13 -3
  33. package/dist/commands/exec/outcomes.js +21 -4
  34. package/dist/commands/exec/plan-run.d.ts +11 -3
  35. package/dist/commands/exec/plan-run.js +3 -2
  36. package/dist/commands/exec/run-command.d.ts +1 -1
  37. package/dist/commands/exec/run-command.js +27 -5
  38. package/dist/commands/exec/test-plan.d.ts +2 -1
  39. package/dist/commands/exec/test-plan.js +13 -4
  40. package/dist/commands/exec/tests-summary.d.ts +2 -2
  41. package/dist/commands/exec/worker-chart.d.ts +1 -1
  42. package/dist/commands/playwright/command.d.ts +10 -7
  43. package/dist/commands/playwright/command.js +14 -14
  44. package/dist/commands/playwright/metadata.js +2 -2
  45. package/dist/commands/runs/list/command.js +6 -6
  46. package/dist/commands/runs/logs/command.js +6 -6
  47. package/dist/commands/runs/show/command.d.ts +2 -2
  48. package/dist/commands/runs/show/command.js +11 -11
  49. package/dist/commands/runs/show/outcomes.d.ts +1 -1
  50. package/dist/commands/snapshots/build/command.js +12 -12
  51. package/dist/commands/snapshots/list/command.js +9 -9
  52. package/dist/commands/vitest/command.d.ts +12 -8
  53. package/dist/commands/vitest/command.js +14 -14
  54. package/dist/commands/vitest/metadata.js +2 -2
  55. package/dist/config/resolve.d.ts +1 -1
  56. package/dist/config/resolve.js +2 -1
  57. package/dist/config/schema.d.ts +8 -0
  58. package/dist/config/schema.js +5 -4
  59. package/dist/extensions/playwright/driver.js +17 -10
  60. package/dist/extensions/testserver/commands/pool/create/command.js +4 -4
  61. package/dist/extensions/testserver/commands/pool/list/command.js +2 -2
  62. package/dist/extensions/testserver/definition.d.ts +1 -1
  63. package/dist/extensions/testserver/extension.d.ts +1 -1
  64. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  65. package/dist/extensions/testserver/options/rules.js +5 -5
  66. package/dist/extensions/testserver/resource.d.ts +1 -1
  67. package/dist/extensions/testserver/vercel-cli/arguments.d.ts +10 -4
  68. package/dist/extensions/testserver/vercel-cli/arguments.js +17 -6
  69. package/dist/extensions/testserver/vercel-cli/environment.d.ts +12 -1
  70. package/dist/extensions/testserver/vercel-cli/environment.js +35 -5
  71. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -0
  72. package/dist/extensions/testserver/vercel-cli/index.js +1 -0
  73. package/dist/extensions/testserver/vercel-cli/invoker.d.ts +28 -13
  74. package/dist/extensions/testserver/vercel-cli/invoker.js +81 -67
  75. package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +4 -10
  76. package/dist/extensions/testserver/vercel-cli/report.js +5 -2
  77. package/dist/extensions/testserver/vercel-cli/session-id.d.ts +8 -0
  78. package/dist/extensions/testserver/vercel-cli/session-id.js +17 -0
  79. package/dist/extensions/testserver/vitest/config.d.ts +2 -2
  80. package/dist/extensions/testserver/vitest/config.js +2 -2
  81. package/dist/extensions/testserver/vitest/container-scope.d.ts +25 -16
  82. package/dist/extensions/testserver/vitest/container-scope.js +32 -13
  83. package/dist/extensions/testserver/vitest/diagnostics.d.ts +14 -12
  84. package/dist/extensions/testserver/vitest/diagnostics.js +29 -21
  85. package/dist/extensions/testserver/vitest/fixtures.d.ts +14 -1
  86. package/dist/extensions/testserver/vitest/fixtures.js +41 -12
  87. package/dist/extensions/testserver/vitest/types.d.ts +16 -0
  88. package/dist/extensions/vitest/driver.js +28 -14
  89. package/dist/extensions/vitest/plan/gateways.d.ts +28 -5
  90. package/dist/extensions/vitest/plan/gateways.js +2 -2
  91. package/dist/extensions/vitest/plan/list-output.d.ts +5 -0
  92. package/dist/extensions/vitest/plan/list-output.js +23 -9
  93. package/dist/extensions/vitest/plan/live/list-gateway.d.ts +3 -2
  94. package/dist/extensions/vitest/plan/live/list-gateway.js +77 -64
  95. package/dist/extensions/vitest/plan/plan-over.d.ts +19 -7
  96. package/dist/extensions/vitest/plan/plan-over.js +18 -7
  97. package/dist/extensions/vitest/plan/plan.d.ts +14 -5
  98. package/dist/extensions/vitest/plan/plan.js +23 -9
  99. package/dist/extensions.d.ts +2 -2
  100. package/dist/run-directory/plan.d.ts +3 -2
  101. package/dist/run-directory/plan.js +6 -3
  102. package/dist/run-directory/run-record.d.ts +4 -3
  103. package/dist/runner/recipe.d.ts +5 -1
  104. package/dist/runner/sandboxed-command.d.ts +5 -3
  105. package/dist/runner/sandboxed-command.js +10 -4
  106. package/dist/sdk/extension/driver.d.ts +32 -6
  107. package/dist/sdk/extension/driver.js +12 -2
  108. package/dist/sdk/extension/index.d.ts +1 -1
  109. package/dist/sdk/extension/index.js +2 -1
  110. package/dist/sdk/extension/resource-definition.d.ts +6 -5
  111. package/dist/vendor/testserver-sdk/container/api-request.d.ts +2 -3
  112. package/dist/vendor/testserver-sdk/container/api-request.js +2 -3
  113. package/dist/vendor/testserver-sdk/container/container.d.ts +12 -2
  114. package/dist/vendor/testserver-sdk/container/container.js +10 -7
  115. package/dist/vendor/testserver-sdk/container/recorder.d.ts +29 -7
  116. package/dist/vendor/testserver-sdk/container/recorder.js +26 -14
  117. package/dist/vendor/testserver-sdk/index.d.ts +1 -1
  118. package/dist/vendor/testserver-sdk/index.js +1 -1
  119. package/dist/vendor/testserver-sdk/proxy/exchange.d.ts +24 -5
  120. package/dist/vendor/testserver-sdk/proxy/exchange.js +43 -25
  121. package/dist/vendor/testserver-sdk/proxy/faulted-exchange.js +15 -10
  122. package/dist/vendor/testserver-sdk/proxy/faults.d.ts +6 -5
  123. package/dist/vendor/testserver-sdk/proxy/proxy.d.ts +10 -1
  124. package/dist/vendor/testserver-sdk/proxy/proxy.js +5 -3
  125. package/dist/vendor/testserver-sdk/proxy/records.d.ts +17 -17
  126. package/dist/vendor/testserver-sdk/proxy/records.js +18 -17
  127. package/dist/vendor/testserver-sdk/records/body.d.ts +7 -9
  128. package/dist/vendor/testserver-sdk/records/body.js +10 -15
  129. package/dist/vendor/testserver-sdk/records/headers.d.ts +79 -0
  130. package/dist/vendor/testserver-sdk/records/headers.js +162 -0
  131. package/dist/vendor/testserver-sdk/records/index.d.ts +2 -1
  132. package/dist/vendor/testserver-sdk/records/index.js +4 -2
  133. package/dist/vendor/testserver-sdk/records/records.d.ts +19 -10
  134. package/package.json +5 -4
  135. package/skills/overview.md +5 -5
  136. package/skills/testserver-builds.md +0 -82
@@ -6,7 +6,7 @@ import {
6
6
  redactingObserver,
7
7
  redactingTerminal,
8
8
  redactor
9
- } from "./chunk-N7E6DAUE.js";
9
+ } from "./chunk-27P2QSIM.js";
10
10
  import {
11
11
  criticalPathStep,
12
12
  recordedPlan,
@@ -17,23 +17,23 @@ import {
17
17
  testsChart,
18
18
  testsSummaryLines,
19
19
  waterfallLines
20
- } from "./chunk-AX4EQZUS.js";
20
+ } from "./chunk-BFLYGMG3.js";
21
21
  import {
22
22
  builtAtText,
23
23
  rejectionLines,
24
24
  snapshotCacheNoteText
25
- } from "./chunk-2NZXL6OH.js";
25
+ } from "./chunk-XPCUINWS.js";
26
26
  import {
27
27
  DEFINITION_SET,
28
28
  RESOURCES
29
- } from "./chunk-5UMJNVKT.js";
29
+ } from "./chunk-Z5OXOZD3.js";
30
30
  import {
31
31
  sandboxConnectPage
32
32
  } from "./chunk-NMVODY3P.js";
33
33
  import {
34
34
  recordRun,
35
35
  timelineSchema
36
- } from "./chunk-YGS5VRQT.js";
36
+ } from "./chunk-RKONDLPS.js";
37
37
  import {
38
38
  isoSecondsText,
39
39
  keepTimeText,
@@ -46,7 +46,7 @@ import {
46
46
  truncate,
47
47
  visibleLength,
48
48
  withArticle
49
- } from "./chunk-RTILVSYQ.js";
49
+ } from "./chunk-QBR5VHJ7.js";
50
50
  import {
51
51
  EMPTY_RUN_STATE,
52
52
  cleanupProblems,
@@ -59,7 +59,7 @@ import {
59
59
  setupPhaseWords,
60
60
  timedProgress,
61
61
  warningTally
62
- } from "./chunk-6EQKA7LI.js";
62
+ } from "./chunk-5TMHYH7G.js";
63
63
  import {
64
64
  RUNNER_SECRET_MIN_LENGTH,
65
65
  configErrors,
@@ -75,11 +75,11 @@ import {
75
75
  requireTarget,
76
76
  settleCredential,
77
77
  settleRunResources
78
- } from "./chunk-ZDJLKF2G.js";
78
+ } from "./chunk-5ED3IDUJ.js";
79
79
  import {
80
80
  describeMintFailure,
81
81
  isCi
82
- } from "./chunk-YT5OROR7.js";
82
+ } from "./chunk-RA4L2ACU.js";
83
83
  import {
84
84
  NodeSignalCancellation
85
85
  } from "./chunk-BW2ADH7U.js";
@@ -90,6 +90,38 @@ import {
90
90
  renderOutcome
91
91
  } from "./chunk-YM6TZV4L.js";
92
92
 
93
+ // src/commands/exec/exec-words.ts
94
+ var EXEC_HELP = {
95
+ usage: "-- <command...>",
96
+ args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR when that env sets neither, with paths under the repository's root rewritten.",
97
+ verbose: "which asks the command to print what each test does as it happens, for passing tests too",
98
+ examples: [
99
+ {
100
+ argv: "-- pnpm test",
101
+ description: "Run the package's test script in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts."
102
+ },
103
+ {
104
+ argv: "--keep-sandbox 2h -- pnpm test",
105
+ description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it."
106
+ },
107
+ {
108
+ argv: "--unsandboxed -- node scripts/smoke.mjs",
109
+ description: "Run a Node.js script on this machine, with the resources storm.config.ts declares, if any."
110
+ }
111
+ ]
112
+ };
113
+ var EXEC_HINTS = {
114
+ // The command's test runner reported no final result. Which one it is the launcher can't tell, so the hint names
115
+ // storm's reporter for each: the Vitest one and the Playwright one, by their published paths.
116
+ noFinalResults: "add storm's reporter to the test runner's config (stormReporter() from @vercel/storm/vitest/config for Vitest, @vercel/storm/playwright/reporter for Playwright)",
117
+ // The command may run no test at all, so the steps say they apply if it does, and name storm's reporter for each test
118
+ // runner, under either npm name.
119
+ addReporter: [
120
+ `If the command runs tests, add storm's reporter to its test runner's config: for Vitest, set test.reporters to stormReporters() from "@vercel/storm/vitest/config"; for Playwright, add ["@vercel/storm/playwright/reporter"] to the reporter list. In a package that installs storm as @cnc-tools/storm, use "@cnc-tools/storm/vitest/config" or "@cnc-tools/storm/playwright/reporter".`,
121
+ "Remove any --reporter from the test runner's arguments, since it replaces the config's reporters, storm's among them. Then run the same storm exec command again."
122
+ ]
123
+ };
124
+
93
125
  // src/commands/exec/cleanup.ts
94
126
  import { z } from "zod";
95
127
  var notStoppedSchema = z.object({
@@ -192,6 +224,19 @@ function runnerCleanupOf(report) {
192
224
  // src/commands/exec/outcomes.ts
193
225
  import { z as z4 } from "zod";
194
226
 
227
+ // src/commands/exec/final-results.ts
228
+ function lacksFinalResults(exitCode, read) {
229
+ return exitCode === 0 && read.collected && read.finalResults === 0 && !read.partial;
230
+ }
231
+ var NO_FINAL_RESULTS_MESSAGE = "The command exited 0, but storm got no final test result from it, so the run saved no test results. A test runner reports them only with storm's reporter in its config, and a --reporter on its command line replaces the config's reporters.";
232
+ function noFinalResultsContent(noFinalTestResults, hints) {
233
+ if (!noFinalTestResults) return { warnings: [], next: [] };
234
+ return {
235
+ warnings: [{ reason: "no_final_test_results", message: NO_FINAL_RESULTS_MESSAGE }],
236
+ next: hints.addReporter.map((text) => ({ type: "text", text }))
237
+ };
238
+ }
239
+
195
240
  // src/commands/exec/mint-failed.ts
196
241
  import { z as z2 } from "zod";
197
242
  var mintFailedErrors = defineErrors({
@@ -389,10 +434,20 @@ var ranSchema = z4.object({
389
434
  /** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
390
435
  timeline: timelineSchema,
391
436
  /** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
392
- runId: z4.string().nullable()
437
+ runId: z4.string().nullable(),
438
+ /**
439
+ * Whether the run saved no final test result though its command exited 0: storm handed the command a test events
440
+ * file and read every line of it, and none was a final result. Then the result warns `no_final_test_results`, whose
441
+ * next steps add storm's reporter to the test runner's config.
442
+ */
443
+ noFinalTestResults: z4.boolean()
393
444
  });
394
- var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
395
- function renderRan(ran) {
445
+ var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code. A run whose command exited 0 but saved no final test result warns no_final_test_results.";
446
+ function ranRenderer(hints) {
447
+ return (ran) => renderRan(ran, hints);
448
+ }
449
+ function renderRan(ran, hints) {
450
+ const noFinal = noFinalResultsContent(ran.noFinalTestResults, hints);
396
451
  const warnings = [
397
452
  ...DEFINITION_SET.reports.ranWarnings(ran.resources),
398
453
  ...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
@@ -402,12 +457,14 @@ function renderRan(ran) {
402
457
  }
403
458
  ] : [],
404
459
  ...runnerCleanupWarnings(ran.cleanup.runner),
405
- ...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources)
460
+ ...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
461
+ ...noFinal.warnings
406
462
  ];
407
463
  const kept = ran.cleanup.runner?.kept ?? null;
408
464
  return renderOutcome({
409
465
  ...kept === null ? {} : { message: keptText(kept) },
410
- ...warnings.length === 0 ? {} : { warnings }
466
+ ...warnings.length === 0 ? {} : { warnings },
467
+ ...noFinal.next.length === 0 ? {} : { next: [...noFinal.next] }
411
468
  });
412
469
  }
413
470
  var runErrors = defineErrors({
@@ -600,7 +657,7 @@ var RUN_ERRORS = {
600
657
  ...runErrors
601
658
  };
602
659
  var outcomes = defineOutcomes({
603
- results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: renderRan } },
660
+ results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: ranRenderer(EXEC_HINTS) } },
604
661
  errors: RUN_ERRORS
605
662
  });
606
663
 
@@ -1436,7 +1493,7 @@ async function planRun(app, lifecycles, request, planCommand, signal) {
1436
1493
  }
1437
1494
  const merged = settleRunResources(file, request.given);
1438
1495
  if (!merged.ok) return merged;
1439
- const command = await planCommand(where, signal);
1496
+ const command = await planCommand(where, signal, { testPlan: settings.testPlan?.value === true });
1440
1497
  if (signal.aborted) return refused(canceledBeforeStart());
1441
1498
  if (!command.ok) {
1442
1499
  const secrets = [
@@ -1548,6 +1605,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
1548
1605
  });
1549
1606
  const observer = recording.observer(view.observer);
1550
1607
  const terminal = recording.terminal(view.runnerTerminal);
1608
+ const collected = run.runner !== void 0 || recording.testEvents !== void 0;
1551
1609
  let outcome;
1552
1610
  try {
1553
1611
  const ended = await executeRun(
@@ -1565,11 +1623,18 @@ async function runCommand({ app, ui, signal }, request, spec) {
1565
1623
  throw error;
1566
1624
  }
1567
1625
  sigterm.release();
1568
- const ran = await summarize(app, { command: spec.name, hints: spec.hints, view, recording, outcome });
1626
+ const { timeline: ran, finalResults } = await summarize(app, {
1627
+ command: spec.name,
1628
+ hints: spec.hints,
1629
+ view,
1630
+ recording,
1631
+ outcome
1632
+ });
1569
1633
  switch (outcome.kind) {
1570
1634
  case "ran": {
1571
- app.exit.status = commandExitStatus(outcome.command);
1572
1635
  const { command } = outcome;
1636
+ const runId = recording.opened.ok ? recording.opened.id : null;
1637
+ app.exit.status = commandExitStatus(outcome.command);
1573
1638
  return spec.ran(
1574
1639
  {
1575
1640
  version: app.version,
@@ -1590,7 +1655,11 @@ async function runCommand({ app, ui, signal }, request, spec) {
1590
1655
  buildMs: outcome.runner.buildMs
1591
1656
  },
1592
1657
  timeline: ran,
1593
- runId: recording.opened.ok ? recording.opened.id : null
1658
+ runId,
1659
+ noFinalTestResults: lacksFinalResults(command.kind === "exited" ? command.code : null, {
1660
+ ...finalResults,
1661
+ collected
1662
+ })
1594
1663
  },
1595
1664
  { testPlan, options: planOptions }
1596
1665
  );
@@ -1749,7 +1818,13 @@ async function summarize(app, run) {
1749
1818
  ]
1750
1819
  })
1751
1820
  );
1752
- return timeline;
1821
+ return {
1822
+ timeline,
1823
+ finalResults: {
1824
+ finalResults: tests.events.filter((event) => event.kind === "test-result").length,
1825
+ partial: tests.unreadable > 0 || tests.incomplete !== void 0
1826
+ }
1827
+ };
1753
1828
  }
1754
1829
  function workerClock({ timeline, workerOffsetMs }) {
1755
1830
  const tests = timeline.rows.find((row) => row.name === "tests");
@@ -1838,12 +1913,14 @@ function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
1838
1913
  }
1839
1914
 
1840
1915
  export {
1916
+ EXEC_HELP,
1917
+ EXEC_HINTS,
1841
1918
  notStoppedText,
1842
1919
  notDeletedText,
1843
1920
  RUN_CLEANUP,
1844
1921
  ranSchema,
1845
1922
  RAN_DESCRIPTION,
1846
- renderRan,
1923
+ ranRenderer,
1847
1924
  runErrors,
1848
1925
  RUN_ERRORS,
1849
1926
  outcomes,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  testserverPoolDefinition
3
- } from "./chunk-IYM44FUX.js";
3
+ } from "./chunk-UC6DULWY.js";
4
4
  import {
5
5
  driverContexts,
6
6
  driversOf,
7
7
  resourceDefinitionSet,
8
8
  resourcesOf
9
- } from "./chunk-6EQKA7LI.js";
9
+ } from "./chunk-5TMHYH7G.js";
10
10
  import {
11
11
  argsText,
12
12
  booleanOption,
@@ -14,7 +14,7 @@ import {
14
14
  defineResource,
15
15
  mustBe,
16
16
  resourceFactory
17
- } from "./chunk-YT5OROR7.js";
17
+ } from "./chunk-RA4L2ACU.js";
18
18
  import {
19
19
  testserverExtensionCommands
20
20
  } from "./chunk-GQIL3AHY.js";
@@ -529,14 +529,14 @@ var playwrightDriver = defineDriver({
529
529
  },
530
530
  help: {
531
531
  usage: "[<playwright test args>...] [-- <playwright dash options>...]",
532
- args: "What playwright test gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as --project or --grep. Give file filters before --: Playwright reads each argument after --project as another project. playwright test --list gets the same arguments when it counts the tests.",
532
+ args: "What playwright test gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as --project or --grep. Give file filters before --: Playwright reads each argument after --project as another project. playwright test --list gets the same arguments when it counts the tests, where storm.config.ts sets testPlan.",
533
533
  // Nothing storm brings a Playwright project reads the run payload's `verbose`: storm's Playwright reporter never
534
534
  // prints (`printsToStdio()` is false).
535
535
  verbose: "which test code can read; storm's Playwright reporter prints nothing either way",
536
536
  examples: [
537
537
  {
538
538
  argv: "",
539
- description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts, each resource that sizes itself sized from the test count."
539
+ description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts. Where it sets testPlan, storm counts the tests first, and each resource that sizes itself is sized from that count."
540
540
  },
541
541
  {
542
542
  argv: "--unsandboxed tests/login.spec.ts -- --project chromium",
@@ -547,18 +547,24 @@ var playwrightDriver = defineDriver({
547
547
  hints: {
548
548
  // No final result: the Playwright config doesn't list storm's Playwright reporter, or a `--reporter` on
549
549
  // Playwright's command line replaced it. A config lists a reporter as a tuple of its module name.
550
- noFinalResults: 'add ["@vercel/storm/playwright/reporter"] to the reporter list in playwright.config'
550
+ noFinalResults: 'add ["@vercel/storm/playwright/reporter"] to the reporter list in playwright.config',
551
+ // storm's Playwright reporter prints nothing, so the steps keep a reporter a person reads beside it. The package may
552
+ // install storm under either of its npm names.
553
+ addReporter: [
554
+ 'In the Playwright config the run loads (playwright.config.ts, or the file --config names), set reporter to a list that holds ["@vercel/storm/playwright/reporter"], as in defineConfig({ reporter: [["list"], ["@vercel/storm/playwright/reporter"]] }). If reporter already names reporters, keep them and add ["@vercel/storm/playwright/reporter"] to the list. In a package that installs storm as @cnc-tools/storm, name "@cnc-tools/storm/playwright/reporter".',
555
+ "Remove any --reporter from the arguments given to playwright test, since it replaces the config's reporters, storm's among them. Then run the same storm playwright command again."
556
+ ]
551
557
  },
552
558
  refusals: {
553
559
  noMatchingTests: {
554
- description: "playwright test --list found no test for the arguments given to playwright test, so nothing was minted, acquired or started.",
560
+ description: "storm.config.ts sets testPlan, and playwright test --list found no test for the arguments given to playwright test, so nothing was minted, acquired or started.",
555
561
  message: ({ args, cwd }) => `playwright test --list found no test for playwright test ${argsText(args)} in ${cwd}. The command didn't run.`,
556
562
  next: ({ args }) => `Change the arguments given to playwright test (${argsText(args)}), then retry. Put Playwright's own dash options after --.`
557
563
  },
558
564
  planFailed: {
559
- description: "storm couldn't count the tests before the run: playwright wasn't found or failed to start, didn't finish within 120s, exited other than 0, or wrote something other than a list of tests. Nothing was minted, acquired or started.",
565
+ description: "storm couldn't plan the run: playwright wasn't found, or, where storm.config.ts sets testPlan, playwright test --list failed to start, didn't finish within 120s, exited other than 0, or wrote something other than a list of tests. Nothing was minted, acquired or started.",
560
566
  next: {
561
- "start-failed": "Install @playwright/test in the package, or run the command with storm exec, which counts nothing.",
567
+ "start-failed": "Install @playwright/test in the package, or run the command with storm exec, which needs no playwright.",
562
568
  "timed-out": "Check why playwright test --list doesn't finish, such as a config file that waits, then retry.",
563
569
  exited: "Fix what playwright test --list reports, then retry.",
564
570
  "unreadable-output": "Check that the package's playwright writes its list with --reporter=json to the file PLAYWRIGHT_JSON_OUTPUT_FILE names, then retry."
@@ -652,78 +658,93 @@ import { spawn as spawn2 } from "node:child_process";
652
658
  // src/extensions/vitest/plan/list-output.ts
653
659
  import { z as z4 } from "zod";
654
660
  var VITEST_LIST = z4.array(z4.looseObject({ name: z4.string(), file: z4.string() }));
661
+ var VITEST_FILE_LIST = z4.array(z4.looseObject({ file: z4.string() }));
655
662
  function readVitestList(stdout) {
656
- let document;
663
+ const parsed = VITEST_LIST.safeParse(readJson(stdout, "`vitest list --json`"));
664
+ if (!parsed.success) throw new Error("`vitest list --json` did not print a list of tests");
665
+ return parsed.data.map(({ name, file }) => ({ name, file }));
666
+ }
667
+ function readVitestFileList(stdout) {
668
+ const parsed = VITEST_FILE_LIST.safeParse(readJson(stdout, "`vitest list --filesOnly --json`"));
669
+ if (!parsed.success) throw new Error("`vitest list --filesOnly --json` did not print a list of files");
670
+ return parsed.data.map(({ file }) => file);
671
+ }
672
+ function readJson(stdout, command) {
657
673
  try {
658
- document = JSON.parse(stdout);
674
+ return JSON.parse(stdout);
659
675
  } catch {
660
- throw new Error("`vitest list --json` did not print JSON");
676
+ throw new Error(`${command} did not print JSON`);
661
677
  }
662
- const parsed = VITEST_LIST.safeParse(document);
663
- if (!parsed.success) throw new Error("`vitest list --json` did not print a list of tests");
664
- return parsed.data.map(({ name, file }) => ({ name, file }));
665
678
  }
666
679
 
667
680
  // src/extensions/vitest/plan/live/list-gateway.ts
668
681
  var liveVitestListGateway = {
669
- listTests(request) {
670
- return new Promise((resolve2) => {
671
- let settled = false;
672
- const settle = (result) => {
673
- if (settled) return;
674
- settled = true;
675
- resolve2(result);
676
- };
677
- const timeout = AbortSignal.timeout(request.timeoutMs);
678
- const child = spawn2(request.executable ?? "vitest", listArgv2(request.args), {
679
- ...request.cwd === void 0 ? {} : { cwd: request.cwd },
680
- stdio: ["ignore", "pipe", "pipe"],
681
- signal: request.signal === void 0 ? timeout : AbortSignal.any([timeout, request.signal])
682
- });
683
- let stopped;
684
- let stdout = "";
685
- let stderr = "";
686
- child.stdout.setEncoding("utf8").on("data", (chunk) => {
687
- stdout += chunk;
688
- });
689
- child.stderr.setEncoding("utf8").on("data", (chunk) => {
690
- stderr += chunk;
691
- });
692
- child.on("error", (error) => {
693
- if (error.name !== "AbortError") {
694
- settle({ ok: false, failure: { kind: "start-failed", message: error.message } });
695
- return;
696
- }
697
- stopped = request.signal?.aborted === true ? { kind: "canceled" } : { kind: "timed-out", timeoutMs: request.timeoutMs };
698
- if (child.exitCode !== null || child.signalCode !== null) settle({ ok: false, failure: stopped });
699
- });
700
- child.on("exit", () => {
701
- if (stopped !== void 0) settle({ ok: false, failure: stopped });
702
- });
703
- child.on("close", (exitCode, signal) => {
704
- if (stopped !== void 0) {
705
- settle({ ok: false, failure: stopped });
706
- return;
707
- }
708
- if (exitCode !== 0) {
709
- settle({ ok: false, failure: { kind: "exited", exitCode, signal, lastStderrLine: lastLine2(stderr) } });
710
- return;
711
- }
712
- try {
713
- settle({ ok: true, tests: readVitestList(stdout) });
714
- } catch (error) {
715
- settle({ ok: false, failure: { kind: "unreadable-output", message: error.message } });
716
- }
717
- });
718
- });
682
+ async listTests(request) {
683
+ const listed = await runList(request, ["--json"], readVitestList);
684
+ return listed.ok ? { ok: true, tests: listed.value } : listed;
685
+ },
686
+ async listFiles(request) {
687
+ const listed = await runList(request, ["--filesOnly", "--json"], readVitestFileList);
688
+ return listed.ok ? { ok: true, files: listed.value } : listed;
719
689
  }
720
690
  };
691
+ function runList(request, flags, read) {
692
+ return new Promise((resolve2) => {
693
+ let settled = false;
694
+ const settle = (result) => {
695
+ if (settled) return;
696
+ settled = true;
697
+ resolve2(result);
698
+ };
699
+ const timeout = AbortSignal.timeout(request.timeoutMs);
700
+ const child = spawn2(request.executable ?? "vitest", listArgv2(request.args, flags), {
701
+ ...request.cwd === void 0 ? {} : { cwd: request.cwd },
702
+ stdio: ["ignore", "pipe", "pipe"],
703
+ signal: request.signal === void 0 ? timeout : AbortSignal.any([timeout, request.signal])
704
+ });
705
+ let stopped;
706
+ let stdout = "";
707
+ let stderr = "";
708
+ child.stdout.setEncoding("utf8").on("data", (chunk) => {
709
+ stdout += chunk;
710
+ });
711
+ child.stderr.setEncoding("utf8").on("data", (chunk) => {
712
+ stderr += chunk;
713
+ });
714
+ child.on("error", (error) => {
715
+ if (error.name !== "AbortError") {
716
+ settle({ ok: false, failure: { kind: "start-failed", message: error.message } });
717
+ return;
718
+ }
719
+ stopped = request.signal?.aborted === true ? { kind: "canceled" } : { kind: "timed-out", timeoutMs: request.timeoutMs };
720
+ if (child.exitCode !== null || child.signalCode !== null) settle({ ok: false, failure: stopped });
721
+ });
722
+ child.on("exit", () => {
723
+ if (stopped !== void 0) settle({ ok: false, failure: stopped });
724
+ });
725
+ child.on("close", (exitCode, signal) => {
726
+ if (stopped !== void 0) {
727
+ settle({ ok: false, failure: stopped });
728
+ return;
729
+ }
730
+ if (exitCode !== 0) {
731
+ settle({ ok: false, failure: { kind: "exited", exitCode, signal, lastStderrLine: lastLine2(stderr) } });
732
+ return;
733
+ }
734
+ try {
735
+ settle({ ok: true, value: read(stdout) });
736
+ } catch (error) {
737
+ settle({ ok: false, failure: { kind: "unreadable-output", message: error.message } });
738
+ }
739
+ });
740
+ });
741
+ }
721
742
  function lastLine2(text) {
722
743
  return text.split(/\r?\n/).map((line) => line.trim()).findLast((line) => line !== "" && !/^at\s/.test(line)) ?? "";
723
744
  }
724
- function listArgv2(args) {
745
+ function listArgv2(args, flags) {
725
746
  const end = args.indexOf("--");
726
- return end === -1 ? ["list", ...args, "--json"] : ["list", ...args.slice(0, end), "--json", ...args.slice(end)];
747
+ return end === -1 ? ["list", ...args, ...flags] : ["list", ...args.slice(0, end), ...flags, ...args.slice(end)];
727
748
  }
728
749
 
729
750
  // src/extensions/vitest/plan/plan-over.ts
@@ -733,18 +754,26 @@ async function planVitestRunOver(options, gateway) {
733
754
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
734
755
  throw new TypeError(`planVitestRun: timeoutMs is ${String(timeoutMs)}, not a positive number`);
735
756
  }
736
- const listed = await gateway.listTests({
757
+ const request = {
737
758
  args: options.args,
738
759
  ...options.cwd === void 0 ? {} : { cwd: options.cwd },
739
760
  ...options.executable === void 0 ? {} : { executable: options.executable },
740
761
  timeoutMs,
741
762
  ...options.signal === void 0 ? {} : { signal: options.signal }
742
- });
743
- return listed.ok ? { ok: true, plan: planOf2(listed.tests) } : { ok: false, failure: listed.failure };
763
+ };
764
+ if (options.countTests === true) {
765
+ const listed2 = await gateway.listTests(request);
766
+ return listed2.ok ? { ok: true, plan: planOf2(listed2.tests) } : { ok: false, failure: listed2.failure };
767
+ }
768
+ const listed = await gateway.listFiles(request);
769
+ return listed.ok ? { ok: true, plan: planOfFiles(listed.files) } : { ok: false, failure: listed.failure };
744
770
  }
745
771
  function planOf2(tests) {
746
772
  return { tests: tests.length, files: new Set(tests.map((test) => test.file)).size };
747
773
  }
774
+ function planOfFiles(files) {
775
+ return { files: new Set(files).size };
776
+ }
748
777
 
749
778
  // src/extensions/vitest/plan/plan.ts
750
779
  function vitestRunArgv(executable, args) {
@@ -773,17 +802,20 @@ var vitestDriver = defineDriver({
773
802
  program: { bin: "vitest" },
774
803
  context: () => ({ list: liveVitestListGateway }),
775
804
  launch: vitestRunArgv,
776
- // `vitest list --json <args>`, which may take 60s (`LIST_TIMEOUT_MS`); a failure in `describeVitestListFailure`'s
777
- // words.
778
- plan: ({ list }) => async ({ args, cwd, bin, signal }) => {
779
- const planned = await planVitestRunOver({ args, cwd, executable: bin, signal }, list);
805
+ // For a run that counts, `vitest list <args> --filesOnly --json`, or `vitest list <args> --json` under
806
+ // `--count-tests`, which may take 60s (`LIST_TIMEOUT_MS`); a failure in `describeVitestListFailure`'s words.
807
+ plan: ({ list }) => async ({ args, cwd, bin, countTests, signal }) => {
808
+ const planned = await planVitestRunOver({ args, cwd, executable: bin, countTests, signal }, list);
780
809
  if (planned.ok) return planned;
781
810
  const { failure } = planned;
782
811
  return { ok: false, kind: failure.kind, message: describeVitestListFailure(failure) };
783
812
  },
813
+ countTests: {
814
+ description: "Count each test before the run with vitest list --json, not only the test files with vitest list --filesOnly --json. vitest list then imports every test file on this machine to collect its tests, which can take most of a minute for a suite of hundreds of files and needs what the test files import to resolve here, such as a current build of the workspace's packages. In return, the run refuses with no_matching_tests when a -t matches no test, and its test plan holds the number of tests. It counts whether or not storm.config.ts sets testPlan. Without it, a run whose storm.config.ts sets testPlan counts only the files, which applies the file filters and --project but not -t: a -t that matches no test starts the run, and vitest run skips every test and exits 0."
815
+ },
784
816
  help: {
785
- usage: "[<vitest run args>...] [-- <vitest dash options>...]",
786
- args: "What vitest run gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as -t or --project. vitest list --json gets the same arguments when it counts the tests.",
817
+ usage: "[--count-tests] [<vitest run args>...] [-- <vitest dash options>...]",
818
+ args: "What vitest run gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as -t or --project. vitest list gets the same arguments when it counts the test files, where storm.config.ts sets testPlan, or the tests with --count-tests.",
787
819
  // What a Vitest project's storm code does with the run payload's `verbose`: `stormReporters()` picks vitest's
788
820
  // `verbose` reporter (`@vercel/storm/vitest/config`), and an extension's Vitest fixtures print as each test
789
821
  // goes.
@@ -791,31 +823,41 @@ var vitestDriver = defineDriver({
791
823
  examples: [
792
824
  {
793
825
  argv: "",
794
- description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts, each resource that sizes itself sized from the test count."
826
+ description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts. Where it sets testPlan, storm counts the test files first, and each resource that sizes itself is sized from that count."
795
827
  },
796
828
  {
797
829
  argv: "test/api -- -t creates",
798
830
  description: "Run the tests named creates in the files under test/api."
831
+ },
832
+ {
833
+ argv: "--count-tests test/api -- -t creates",
834
+ description: "Count the tests named creates in the files under test/api before the run, refusing with no_matching_tests when there is none, then run them."
799
835
  }
800
836
  ]
801
837
  },
802
838
  hints: {
803
839
  // No final result: the Vitest config lacks `stormReporter`, or a `--reporter` on vitest's command line replaced it.
804
- noFinalResults: "add stormReporter() to vitest.config's reporters (@vercel/storm/vitest/config)"
840
+ noFinalResults: "add stormReporter() to vitest.config's reporters (@vercel/storm/vitest/config)",
841
+ // `stormReporters()` keeps vitest's own output and reports nothing outside a storm run, so the steps add it
842
+ // unconditionally. The package may install storm under either of its npm names.
843
+ addReporter: [
844
+ 'In the Vitest config the run loads (vitest.config.ts, or the file --config names), import { stormReporters } from "@vercel/storm/vitest/config" and set test.reporters to stormReporters(), as in defineConfig({ test: { reporters: stormReporters() } }). If test.reporters already lists reporters, keep them and add stormReporter() from the same module to the list instead. In a package that installs storm as @cnc-tools/storm, import from "@cnc-tools/storm/vitest/config".',
845
+ "Remove any --reporter from the arguments given to vitest run, since it replaces the config's reporters, storm's among them. Then run the same storm vitest command again."
846
+ ]
805
847
  },
806
848
  refusals: {
807
849
  noMatchingTests: {
808
- description: "vitest list found no test for the arguments given to vitest run, so nothing was minted, acquired or started.",
850
+ description: "The run counts, since storm.config.ts sets testPlan or the run took --count-tests, and vitest list found no test file for the arguments given to vitest run, or no test with --count-tests, so nothing was minted, acquired or started.",
809
851
  message: ({ args, cwd }) => `vitest list found no test for vitest run ${argsText(args)} in ${cwd}. The command didn't run.`,
810
852
  next: ({ args }) => `Change the arguments given to vitest run (${argsText(args)}), then retry. Put vitest's own dash options after --.`
811
853
  },
812
854
  planFailed: {
813
- description: "storm couldn't count the tests before the run: vitest wasn't found or failed to start, didn't finish within 60s, exited other than 0, or printed something other than a list of tests. Nothing was minted, acquired or started.",
855
+ description: "storm couldn't plan the run: vitest wasn't found, or, for a run that counts, vitest list failed to start, didn't finish within 60s, exited other than 0, or printed something other than a list of files or tests. Nothing was minted, acquired or started.",
814
856
  next: {
815
- "start-failed": "Install vitest in the package, or run the command with storm exec, which counts nothing.",
816
- "timed-out": "Check why vitest list doesn't finish, such as a global setup that waits, then retry.",
857
+ "start-failed": "Install vitest in the package, or run the command with storm exec, which needs no vitest.",
858
+ "timed-out": "Check why vitest list doesn't finish, such as a global setup that waits, then retry. Without --count-tests it counts only the files, which imports no test file, and without testPlan in storm.config.ts it counts nothing.",
817
859
  exited: "Fix what vitest list reports, then retry. vitest list takes the arguments vitest run does, but refuses some run-only options.",
818
- "unreadable-output": "Check that the package's vitest prints its list with --json, then retry."
860
+ "unreadable-output": "Check that the package's vitest prints its list with --json, and with --filesOnly --json, then retry."
819
861
  }
820
862
  }
821
863
  }
@@ -9,7 +9,7 @@ import {
9
9
  isoSecondsText,
10
10
  seconds,
11
11
  short
12
- } from "./chunk-RTILVSYQ.js";
12
+ } from "./chunk-QBR5VHJ7.js";
13
13
 
14
14
  // src/commands/runs/facts.ts
15
15
  import { z } from "zod";
@@ -2,14 +2,14 @@ import {
2
2
  RESOURCES,
3
3
  liveDriverContexts,
4
4
  liveResourceContexts
5
- } from "./chunk-5UMJNVKT.js";
6
- import "./chunk-IYM44FUX.js";
7
- import "./chunk-LQKNI3EG.js";
5
+ } from "./chunk-Z5OXOZD3.js";
6
+ import "./chunk-UC6DULWY.js";
7
+ import "./chunk-BRUIATTR.js";
8
8
  import {
9
9
  RUNS_SUBPATH,
10
10
  liveRunDirectoryGateway,
11
11
  unavailableRunDirectoryGateway
12
- } from "./chunk-YGS5VRQT.js";
12
+ } from "./chunk-RKONDLPS.js";
13
13
  import {
14
14
  liveCommandGateway,
15
15
  liveJobSummaryGateway,
@@ -17,7 +17,7 @@ import {
17
17
  liveProgressTerminal,
18
18
  resolveStateDirectory,
19
19
  stateDirectoryPattern
20
- } from "./chunk-6EQKA7LI.js";
20
+ } from "./chunk-5TMHYH7G.js";
21
21
  import {
22
22
  RUNNER_SNAPSHOTS_SUBPATH,
23
23
  configResolver,
@@ -33,8 +33,8 @@ import {
33
33
  systemClock,
34
34
  systemTimer,
35
35
  unavailableRunnerSnapshotCacheGateway
36
- } from "./chunk-ZDJLKF2G.js";
37
- import "./chunk-YT5OROR7.js";
36
+ } from "./chunk-5ED3IDUJ.js";
37
+ import "./chunk-RA4L2ACU.js";
38
38
  import "./chunk-GQIL3AHY.js";
39
39
  import "./chunk-GSC6SRTW.js";
40
40
  import "./chunk-YM6TZV4L.js";
@@ -76,6 +76,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
76
76
  }, z.core.$strip>>;
77
77
  }, z.core.$strip>;
78
78
  runId: z.ZodNullable<z.ZodString>;
79
+ noFinalTestResults: z.ZodBoolean;
79
80
  }, z.core.$strip>;
80
81
  }, {
81
82
  ran: unknown;
@@ -358,6 +359,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
358
359
  }, z.core.$strip>>;
359
360
  }, z.core.$strip>;
360
361
  runId: z.ZodNullable<z.ZodString>;
362
+ noFinalTestResults: z.ZodBoolean;
361
363
  }, z.core.$strip>;
362
364
  }, {
363
365
  ran: unknown;