@cnc-tools/storm 0.5.0 → 0.6.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 (113) hide show
  1. package/dist/build-info.js +1 -1
  2. package/dist/combine-errors.js +2 -2
  3. package/dist/commands/dashboard.js +1 -1
  4. package/dist/commands/{run → exec}/cleanup.d.ts +1 -1
  5. package/dist/commands/{run → exec}/cleanup.js +1 -1
  6. package/dist/commands/{run/outcomes.d.ts → exec/command.d.ts} +77 -112
  7. package/dist/commands/exec/command.js +23 -0
  8. package/dist/commands/{run → exec}/job-summary.d.ts +5 -1
  9. package/dist/commands/{run → exec}/job-summary.js +5 -2
  10. package/dist/commands/exec/metadata.d.ts +66 -0
  11. package/dist/commands/exec/metadata.js +55 -0
  12. package/dist/commands/{run → exec}/mint-failed.js +4 -4
  13. package/dist/commands/exec/outcomes.d.ts +614 -0
  14. package/dist/commands/exec/outcomes.js +338 -0
  15. package/dist/commands/exec/run-command.d.ts +221 -0
  16. package/dist/commands/exec/run-command.js +663 -0
  17. package/dist/commands/exec/run-metadata.d.ts +56 -0
  18. package/dist/commands/exec/run-metadata.js +58 -0
  19. package/dist/commands/{run → exec}/run-record.d.ts +27 -1
  20. package/dist/commands/{run → exec}/run-record.js +8 -0
  21. package/dist/commands/exec/testserver-flags.d.ts +48 -0
  22. package/dist/commands/exec/testserver-flags.js +80 -0
  23. package/dist/commands/runs/facts.js +2 -2
  24. package/dist/commands/runs/logs/metadata.js +1 -1
  25. package/dist/commands/runs/logs/outcomes.js +4 -1
  26. package/dist/commands/runs/past-run.d.ts +2 -2
  27. package/dist/commands/runs/past-run.js +2 -2
  28. package/dist/commands/runs/show/metadata.js +2 -2
  29. package/dist/commands/runs/show/outcomes.js +7 -4
  30. package/dist/commands/vitest/command.d.ts +299 -0
  31. package/dist/commands/vitest/command.js +138 -0
  32. package/dist/commands/vitest/metadata.d.ts +66 -0
  33. package/dist/commands/vitest/metadata.js +35 -0
  34. package/dist/commands/vitest/outcomes.d.ts +273 -0
  35. package/dist/commands/vitest/outcomes.js +77 -0
  36. package/dist/config/index.d.ts +2 -1
  37. package/dist/config/index.js +1 -0
  38. package/dist/config/resolve.d.ts +3 -3
  39. package/dist/config/resolve.js +3 -3
  40. package/dist/config/resource-config.d.ts +2 -2
  41. package/dist/config/schema.d.ts +1 -1
  42. package/dist/config/set.d.ts +15 -4
  43. package/dist/config/set.js +28 -12
  44. package/dist/config-file/define.d.ts +8 -6
  45. package/dist/context.d.ts +6 -3
  46. package/dist/context.js +4 -2
  47. package/dist/core/command-provider.d.ts +1 -1
  48. package/dist/core/presentation.js +1 -1
  49. package/dist/core/presentations.js +1 -1
  50. package/dist/resources/testserver/command.d.ts +1 -1
  51. package/dist/resources/testserver/command.js +1 -1
  52. package/dist/resources/testserver/config.d.ts +1 -1
  53. package/dist/resources/testserver/config.js +3 -2
  54. package/dist/resources/testserver/credential-facts.js +1 -1
  55. package/dist/resources/testserver/resource.d.ts +2 -2
  56. package/dist/resources/testserver/sandbox/create.d.ts +2 -2
  57. package/dist/resources/testserver/sandbox/create.js +2 -2
  58. package/dist/resources.d.ts +9 -6
  59. package/dist/resources.js +3 -3
  60. package/dist/sdk/index.js +1 -1
  61. package/dist/sdk/payload/payload.d.ts +2 -2
  62. package/dist/sdk/payload/payload.js +2 -2
  63. package/dist/vercel-cli/driver.d.ts +1 -1
  64. package/dist/vercel-cli/entry.d.ts +1 -1
  65. package/dist/vercel-cli/entry.js +1 -1
  66. package/dist/vercel-cli/verbose.d.ts +2 -2
  67. package/dist/vercel-cli/verbose.js +2 -2
  68. package/dist/vitest/config.d.ts +5 -5
  69. package/dist/vitest/config.js +5 -5
  70. package/dist/vitest/find-vitest.d.ts +7 -0
  71. package/dist/vitest/find-vitest.js +28 -0
  72. package/dist/vitest/fixtures.d.ts +2 -2
  73. package/dist/vitest/fixtures.js +3 -3
  74. package/dist/vitest/gateways.d.ts +37 -6
  75. package/dist/vitest/gateways.js +3 -2
  76. package/dist/vitest/live/list-gateway.d.ts +7 -3
  77. package/dist/vitest/live/list-gateway.js +55 -8
  78. package/dist/vitest/plan.d.ts +41 -8
  79. package/dist/vitest/plan.js +47 -16
  80. package/dist/vitest/sandbox.d.ts +1 -1
  81. package/dist/vitest/sandbox.js +1 -1
  82. package/dist/vitest/test-events.d.ts +2 -2
  83. package/dist/vitest/test-events.js +3 -3
  84. package/dist/vitest/test-results.d.ts +1 -1
  85. package/dist/vitest/test-results.js +1 -1
  86. package/dist/vitest/types.d.ts +1 -1
  87. package/package.json +2 -2
  88. package/skills/overview.md +5 -4
  89. package/skills/read-run-output.md +1 -1
  90. package/dist/commands/run/command.d.ts +0 -327
  91. package/dist/commands/run/command.js +0 -620
  92. package/dist/commands/run/metadata.d.ts +0 -47
  93. package/dist/commands/run/metadata.js +0 -83
  94. package/dist/commands/run/outcomes.js +0 -332
  95. /package/dist/commands/{run → exec}/live-view.d.ts +0 -0
  96. /package/dist/commands/{run → exec}/live-view.js +0 -0
  97. /package/dist/commands/{run → exec}/mint-failed.d.ts +0 -0
  98. /package/dist/commands/{run → exec}/progress.d.ts +0 -0
  99. /package/dist/commands/{run → exec}/progress.js +0 -0
  100. /package/dist/commands/{run → exec}/redaction.d.ts +0 -0
  101. /package/dist/commands/{run → exec}/redaction.js +0 -0
  102. /package/dist/commands/{run → exec}/run-collector.d.ts +0 -0
  103. /package/dist/commands/{run → exec}/run-collector.js +0 -0
  104. /package/dist/commands/{run → exec}/tests-summary.d.ts +0 -0
  105. /package/dist/commands/{run → exec}/tests-summary.js +0 -0
  106. /package/dist/commands/{run → exec}/text.d.ts +0 -0
  107. /package/dist/commands/{run → exec}/text.js +0 -0
  108. /package/dist/commands/{run → exec}/view.d.ts +0 -0
  109. /package/dist/commands/{run → exec}/view.js +0 -0
  110. /package/dist/commands/{run → exec}/waterfall.d.ts +0 -0
  111. /package/dist/commands/{run → exec}/waterfall.js +0 -0
  112. /package/dist/commands/{run → exec}/worker-chart.d.ts +0 -0
  113. /package/dist/commands/{run → exec}/worker-chart.js +0 -0
@@ -1,4 +1,8 @@
1
- import type { VitestListGateway } from "./gateways.ts";
1
+ import type { VitestListFailure, VitestListGateway } from "./gateways.ts";
2
+ export { VITEST_BIN, vitestSearchDirectories } from "./find-vitest.ts";
3
+ export type { FindVitestRequest, FindVitestResult, ListedTest, VitestListFailure, VitestListGateway, VitestListRequest, VitestListResult, } from "./gateways.ts";
4
+ export { liveVitestListGateway } from "./live/list-gateway.ts";
5
+ export { WORKERS_PER_SANDBOX } from "./config.ts";
2
6
  /** How long `listVitestTests` lets `vitest list` run by default. */
3
7
  export declare const LIST_TIMEOUT_MS = 60000;
4
8
  /** How many tests a Vitest run would run, and in how many files. */
@@ -7,27 +11,56 @@ export interface TestPlan {
7
11
  readonly files: number;
8
12
  }
9
13
  export interface ListVitestTestsOptions {
10
- /** Passed after `vitest list --json`, as `vitest run` takes them, such as `["--project", "testserver"]`. */
14
+ /** Passed to `vitest list --json`, as `vitest run` takes them, such as `["--project", "testserver"]`. */
11
15
  readonly args: readonly string[];
12
16
  /** Where vitest runs; default the current directory. */
13
17
  readonly cwd?: string;
18
+ /** The `vitest` to start, such as the path `findVitest` found; default `vitest` from `PATH`. */
19
+ readonly executable?: string;
14
20
  /** How long `vitest list` may take; default `LIST_TIMEOUT_MS`, 60s. */
15
21
  readonly timeoutMs?: number;
22
+ /** Stops `vitest list` when it aborts: the plan's failure is then `canceled`. */
23
+ readonly signal?: AbortSignal;
16
24
  }
25
+ /** A Vitest run's test plan, or why its tests couldn't be listed. */
26
+ export type VitestPlanResult = {
27
+ readonly ok: true;
28
+ readonly plan: TestPlan;
29
+ } | {
30
+ readonly ok: false;
31
+ readonly failure: VitestListFailure;
32
+ };
17
33
  /**
18
- * Lists the tests `vitest run <args>` would run, with `vitest list --json <args>` from `PATH`, and counts them.
19
- * Rejects with an `Error` saying why when `vitest` fails to start, doesn't finish within `timeoutMs`, exits other
20
- * than 0 (with the last line of its stderr that isn't a stack frame), or prints something other than a list of tests.
34
+ * Lists the tests `vitest run <args>` would run, with `vitest list <args> --json` (`executable`, else `vitest` from
35
+ * `PATH`), and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within `timeoutMs`, exited
36
+ * other than 0 (with the last line of its stderr that isn't a stack frame), printed something other than a list of
37
+ * tests, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive number.
38
+ */
39
+ export declare function planVitestRun(options: ListVitestTestsOptions, gateway?: VitestListGateway): Promise<VitestPlanResult>;
40
+ /**
41
+ * `planVitestRun`'s plan, rejecting with an `Error` that says why the tests couldn't be listed
42
+ * (`describeVitestListFailure`).
21
43
  */
22
44
  export declare function listVitestTests(options: ListVitestTestsOptions, gateway?: VitestListGateway): Promise<TestPlan>;
45
+ /** The argv that runs `args` with `executable`, a `vitest`: `<executable> run <args...>`. */
46
+ export declare function vitestRunArgv(executable: string, args: readonly string[]): readonly string[];
23
47
  /** The plan `vitest list --json` printed: its tests, and their distinct files. Throws when it isn't a list of tests. */
24
48
  export declare function parseVitestList(stdout: string): TestPlan;
25
49
  /** A plan as a phrase, such as `65 tests in 19 files` or `1 test in 1 file`. */
26
50
  export declare function formatPlan(plan: TestPlan): string;
51
+ /** The most Testserver sandboxes `autoSandboxes` sizes a run for: past it, a run passes `--testserver-sandboxes`. */
52
+ export declare const AUTO_SANDBOXES_MAX = 8;
53
+ /**
54
+ * The Testserver sandboxes `storm vitest` asks for when neither `--testserver-sandboxes` nor the config file says:
55
+ * one per `WORKERS_PER_SANDBOX` (4) files, at least 1 and at most `AUTO_SANDBOXES_MAX` (8) (`sandboxesFor`).
56
+ */
57
+ export declare function autoSandboxes(files: number): number;
27
58
  /**
28
- * The Testserver sandboxes to ask `storm run --set resources.testserverPool.sandboxes=<n>` for: one per
29
- * `workersPerSandbox` files (default `WORKERS_PER_SANDBOX`, 4, as `testserverWorkers` sizes `maxWorkers`), at least
30
- * 1 and at most `max`. A file's tests run in one worker, so more sandboxes than that would sit idle. Throws a `TypeError` unless `files` is a
59
+ * The Testserver sandboxes to ask `storm exec --testserver-sandboxes <n>` for: one per `workersPerSandbox` files
60
+ * (default `WORKERS_PER_SANDBOX`, 4, as `testserverWorkers` sizes `maxWorkers`), at least 1 and at most `max`. A file's
61
+ * tests run in one worker, so more sandboxes than that would sit idle. Throws a `TypeError` unless `files` is a
31
62
  * non-negative integer and `max` and `workersPerSandbox` are positive integers.
32
63
  */
33
64
  export declare function sandboxesFor(files: number, max: number, workersPerSandbox?: number): number;
65
+ /** Why the tests couldn't be listed, as a sentence. */
66
+ export declare function describeVitestListFailure(failure: VitestListFailure): string;
@@ -1,30 +1,49 @@
1
- // The test count of a Vitest run, exported as `@cnc-tools/storm/vitest/plan`, for a launcher that sizes
2
- // `storm run --set resources.testserverPool.sandboxes=<n>` before any Testserver sandbox is leased. Like
3
- // `config.ts`, it imports neither `./fixtures.ts` nor vitest: a launcher script runs outside a Vitest run, where the
4
- // adapter's `test` throws.
1
+ // Planning a Vitest run before any Testserver sandbox is leased, exported as `@cnc-tools/storm/vitest/plan`: finding
2
+ // `vitest` in `node_modules/.bin`, counting the tests `vitest run <args>` would run, sizing the Testserver sandboxes
3
+ // for them, and the `vitest run` argv. It is the adapter's one entry point for the CLI: `storm vitest` imports it
4
+ // and nothing else of the adapter. Like `config.ts`, it imports neither `./fixtures.ts` nor vitest: the CLI and a
5
+ // launcher script run outside a Vitest run, where the adapter's `test` throws.
5
6
  import { WORKERS_PER_SANDBOX } from "./config.js";
6
7
  import { readVitestList } from "./list-output.js";
7
8
  import { liveVitestListGateway } from "./live/list-gateway.js";
9
+ export { VITEST_BIN, vitestSearchDirectories } from "./find-vitest.js";
10
+ export { liveVitestListGateway } from "./live/list-gateway.js";
11
+ export { WORKERS_PER_SANDBOX } from "./config.js";
8
12
  /** How long `listVitestTests` lets `vitest list` run by default. */
9
13
  export const LIST_TIMEOUT_MS = 60_000;
10
14
  /**
11
- * Lists the tests `vitest run <args>` would run, with `vitest list --json <args>` from `PATH`, and counts them.
12
- * Rejects with an `Error` saying why when `vitest` fails to start, doesn't finish within `timeoutMs`, exits other
13
- * than 0 (with the last line of its stderr that isn't a stack frame), or prints something other than a list of tests.
15
+ * Lists the tests `vitest run <args>` would run, with `vitest list <args> --json` (`executable`, else `vitest` from
16
+ * `PATH`), and counts them; or says why it couldn't: `vitest` failed to start, didn't finish within `timeoutMs`, exited
17
+ * other than 0 (with the last line of its stderr that isn't a stack frame), printed something other than a list of
18
+ * tests, or was stopped by `signal` (`canceled`). Throws a `TypeError` unless `timeoutMs` is a positive number.
14
19
  */
15
- export async function listVitestTests(options, gateway = liveVitestListGateway) {
20
+ export async function planVitestRun(options, gateway = liveVitestListGateway) {
16
21
  const timeoutMs = options.timeoutMs ?? LIST_TIMEOUT_MS;
17
22
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
18
- throw new TypeError(`listVitestTests: timeoutMs is ${String(timeoutMs)}, not a positive number`);
23
+ throw new TypeError(`planVitestRun: timeoutMs is ${String(timeoutMs)}, not a positive number`);
19
24
  }
20
25
  const listed = await gateway.listTests({
21
26
  args: options.args,
22
27
  ...(options.cwd === undefined ? {} : { cwd: options.cwd }),
28
+ ...(options.executable === undefined ? {} : { executable: options.executable }),
23
29
  timeoutMs,
30
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
24
31
  });
25
- if (!listed.ok)
26
- throw new Error(describeListFailure(listed.failure));
27
- return planOf(listed.tests);
32
+ return listed.ok ? { ok: true, plan: planOf(listed.tests) } : { ok: false, failure: listed.failure };
33
+ }
34
+ /**
35
+ * `planVitestRun`'s plan, rejecting with an `Error` that says why the tests couldn't be listed
36
+ * (`describeVitestListFailure`).
37
+ */
38
+ export async function listVitestTests(options, gateway = liveVitestListGateway) {
39
+ const planned = await planVitestRun(options, gateway);
40
+ if (!planned.ok)
41
+ throw new Error(describeVitestListFailure(planned.failure));
42
+ return planned.plan;
43
+ }
44
+ /** The argv that runs `args` with `executable`, a `vitest`: `<executable> run <args...>`. */
45
+ export function vitestRunArgv(executable, args) {
46
+ return [executable, "run", ...args];
28
47
  }
29
48
  /** The plan `vitest list --json` printed: its tests, and their distinct files. Throws when it isn't a list of tests. */
30
49
  export function parseVitestList(stdout) {
@@ -34,10 +53,19 @@ export function parseVitestList(stdout) {
34
53
  export function formatPlan(plan) {
35
54
  return `${plan.tests} ${plan.tests === 1 ? "test" : "tests"} in ${plan.files} ${plan.files === 1 ? "file" : "files"}`;
36
55
  }
56
+ /** The most Testserver sandboxes `autoSandboxes` sizes a run for: past it, a run passes `--testserver-sandboxes`. */
57
+ export const AUTO_SANDBOXES_MAX = 8;
58
+ /**
59
+ * The Testserver sandboxes `storm vitest` asks for when neither `--testserver-sandboxes` nor the config file says:
60
+ * one per `WORKERS_PER_SANDBOX` (4) files, at least 1 and at most `AUTO_SANDBOXES_MAX` (8) (`sandboxesFor`).
61
+ */
62
+ export function autoSandboxes(files) {
63
+ return sandboxesFor(files, AUTO_SANDBOXES_MAX);
64
+ }
37
65
  /**
38
- * The Testserver sandboxes to ask `storm run --set resources.testserverPool.sandboxes=<n>` for: one per
39
- * `workersPerSandbox` files (default `WORKERS_PER_SANDBOX`, 4, as `testserverWorkers` sizes `maxWorkers`), at least
40
- * 1 and at most `max`. A file's tests run in one worker, so more sandboxes than that would sit idle. Throws a `TypeError` unless `files` is a
66
+ * The Testserver sandboxes to ask `storm exec --testserver-sandboxes <n>` for: one per `workersPerSandbox` files
67
+ * (default `WORKERS_PER_SANDBOX`, 4, as `testserverWorkers` sizes `maxWorkers`), at least 1 and at most `max`. A file's
68
+ * tests run in one worker, so more sandboxes than that would sit idle. Throws a `TypeError` unless `files` is a
41
69
  * non-negative integer and `max` and `workersPerSandbox` are positive integers.
42
70
  */
43
71
  export function sandboxesFor(files, max, workersPerSandbox = WORKERS_PER_SANDBOX) {
@@ -57,7 +85,8 @@ export function sandboxesFor(files, max, workersPerSandbox = WORKERS_PER_SANDBOX
57
85
  function planOf(tests) {
58
86
  return { tests: tests.length, files: new Set(tests.map((test) => test.file)).size };
59
87
  }
60
- function describeListFailure(failure) {
88
+ /** Why the tests couldn't be listed, as a sentence. */
89
+ export function describeVitestListFailure(failure) {
61
90
  switch (failure.kind) {
62
91
  case "start-failed":
63
92
  return `\`vitest list\` failed to start: ${failure.message}`;
@@ -69,5 +98,7 @@ function describeListFailure(failure) {
69
98
  }
70
99
  case "unreadable-output":
71
100
  return failure.message;
101
+ case "canceled":
102
+ return "`vitest list` was canceled";
72
103
  }
73
104
  }
@@ -1,6 +1,6 @@
1
1
  import type { RunPayload } from "../sdk/index.ts";
2
2
  /** What a test that needs a Testserver sandbox fails with in a run that holds none. */
3
- export declare const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --set resources.testserverPool.sandboxes=<n>";
3
+ export declare const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --testserver-sandboxes <n>";
4
4
  /**
5
5
  * The Testserver URL of the Testserver sandbox the vitest worker numbered `poolId` uses:
6
6
  * `sandboxes[(poolId - 1) % N]` of the run payload's `resources.testserverPool`. `poolId` is the worker's
@@ -1,7 +1,7 @@
1
1
  // Which Testserver sandbox a vitest worker uses, and how many Testserver sandboxes a run counts for sizing workers.
2
2
  // Pure: no vitest import, so `config.ts`, which a `vitest.config.ts` loads, can use it.
3
3
  /** What a test that needs a Testserver sandbox fails with in a run that holds none. */
4
- export const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --set resources.testserverPool.sandboxes=<n>";
4
+ export const NO_TESTSERVER_MESSAGE = "this run has no Testserver; add resources.testserverPool to storm.config.ts or pass --testserver-sandboxes <n>";
5
5
  /**
6
6
  * The Testserver URL of the Testserver sandbox the vitest worker numbered `poolId` uses:
7
7
  * `sandboxes[(poolId - 1) % N]` of the run payload's `resources.testserverPool`. `poolId` is the worker's
@@ -7,12 +7,12 @@ export type TestEventReporter = (event: ReportedTestEvent) => void;
7
7
  export declare const silentTestEvents: TestEventReporter;
8
8
  /**
9
9
  * The reporter for this worker: appends each event, with the worker's `VITEST_POOL_ID` and the time, to the run
10
- * payload's `testEvents` file. Outside `storm run`, when the run payload names no such file, or outside a vitest
10
+ * payload's `testEvents` file. Outside a storm run, when the run payload names no such file, or outside a vitest
11
11
  * worker, it reports nothing; and once an append fails it drops every later event: reporting never fails a test.
12
12
  */
13
13
  export declare function testEventReporter(env?: Readonly<Record<string, string | undefined>>, append?: (path: string, text: string) => void, now?: () => number): TestEventReporter;
14
14
  /**
15
- * The test events file the run payload in `env` names; undefined outside `storm run`, when the run payload
15
+ * The test events file the run payload in `env` names; undefined outside a storm run, when the run payload
16
16
  * names none, or when it can't be read.
17
17
  */
18
18
  export declare function testEventsFile(env: Readonly<Record<string, string | undefined>>): string | undefined;
@@ -1,4 +1,4 @@
1
- // The test events a vitest worker appends to the run payload's `testEvents` file, so `storm run` can show which
1
+ // The test events a vitest worker appends to the run payload's `testEvents` file, so the run can show which
2
2
  // worker runs which file, how long each container start and test attempt takes, and how busy the workers are. A
3
3
  // test's final result comes from vitest's main process instead (`test-results.ts`). Pure but for the append, which a
4
4
  // reporter does with one write a line: a short `O_APPEND` write lands whole beside other workers'.
@@ -8,7 +8,7 @@ import { readRunPayload, RUN_PAYLOAD_VARIABLE, testEventLine, } from "../sdk/ind
8
8
  export const silentTestEvents = () => { };
9
9
  /**
10
10
  * The reporter for this worker: appends each event, with the worker's `VITEST_POOL_ID` and the time, to the run
11
- * payload's `testEvents` file. Outside `storm run`, when the run payload names no such file, or outside a vitest
11
+ * payload's `testEvents` file. Outside a storm run, when the run payload names no such file, or outside a vitest
12
12
  * worker, it reports nothing; and once an append fails it drops every later event: reporting never fails a test.
13
13
  */
14
14
  export function testEventReporter(env = process.env, append = (path, text) => appendFileSync(path, text), now = Date.now) {
@@ -31,7 +31,7 @@ export function testEventReporter(env = process.env, append = (path, text) => ap
31
31
  };
32
32
  }
33
33
  /**
34
- * The test events file the run payload in `env` names; undefined outside `storm run`, when the run payload
34
+ * The test events file the run payload in `env` names; undefined outside a storm run, when the run payload
35
35
  * names none, or when it can't be read.
36
36
  */
37
37
  export function testEventsFile(env) {
@@ -71,7 +71,7 @@ export interface StormReporter {
71
71
  * the run ends. Errors are vitest's, the first `MAX_ERRORS`, each `message` and `diff` cut to `ERROR_TEXT_CHARS` and
72
72
  * `stack` to `STACK_LINES` lines.
73
73
  *
74
- * Outside `storm run`, or when the run payload names no test events file, it reports and keeps nothing; a test
74
+ * Outside a storm run, or when the run payload names no test events file, it reports and keeps nothing; a test
75
75
  * whose result can't be read is dropped; and once an append fails it drops every later result: reporting never fails
76
76
  * a test.
77
77
  */
@@ -32,7 +32,7 @@ export const STACK_LINES = 30;
32
32
  * the run ends. Errors are vitest's, the first `MAX_ERRORS`, each `message` and `diff` cut to `ERROR_TEXT_CHARS` and
33
33
  * `stack` to `STACK_LINES` lines.
34
34
  *
35
- * Outside `storm run`, or when the run payload names no test events file, it reports and keeps nothing; a test
35
+ * Outside a storm run, or when the run payload names no test events file, it reports and keeps nothing; a test
36
36
  * whose result can't be read is dropped; and once an append fails it drops every later result: reporting never fails
37
37
  * a test.
38
38
  */
@@ -5,7 +5,7 @@ import type { ContainerScope } from "./container-scope.ts";
5
5
  export interface StormWorkerFixtures {
6
6
  /** This worker's Testserver sandbox, `sandboxes[(VITEST_POOL_ID - 1) % N]` of the run payload's Testserver pool. */
7
7
  testserverUrl: string;
8
- /** Whether the run is verbose (`storm run --verbose`). */
8
+ /** Whether the run is verbose (its `--verbose`). */
9
9
  verbose: boolean;
10
10
  }
11
11
  /** The adapter's fixtures set up for each test. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnc-tools/storm",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Run a command against Vercel Testserver sandboxes",
5
5
  "repository": {
6
6
  "type": "git",
@@ -119,7 +119,7 @@
119
119
  "test": "pnpm run test:default && pnpm run test:integration",
120
120
  "test:default": "vitest run --project default --project sanity",
121
121
  "test:integration": "vitest run --project integration --passWithNoTests",
122
- "test:testserver": "node bin/storm.js run --local --set resources.testserverPool.sandboxes=2 -- vitest run --project testserver",
122
+ "test:testserver": "node bin/storm.js vitest --local --testserver-sandboxes 2 -- --project testserver",
123
123
  "live:runner": "node scripts/live/runner-checks.ts"
124
124
  }
125
125
  }
@@ -6,14 +6,14 @@ commands: all
6
6
 
7
7
  # Overview
8
8
 
9
- `storm run` runs a command, such as `pnpm test`, in a runner sandbox or on this machine. With a Testserver side, it gives the command Vercel Testserver sandboxes. After the run, the `runs` commands read the run back on this machine.
9
+ `storm vitest` runs vitest, in a runner sandbox or on this machine. First, it counts the tests on this machine. With a Testserver side, it gives vitest Vercel Testserver sandboxes, one for each 4 test files, at most 8. `storm exec` runs a different command, such as `pnpm test`, in the same way, but it does not count tests. After the run, the `runs` commands read the run back on this machine.
10
10
 
11
11
  ## Concepts
12
12
 
13
- - A **run** is one `storm run`. It runs one command, the command after `--`.
13
+ - A **run** is one `storm vitest` or one `storm exec`. It runs one command: `vitest run` for `storm vitest`, the command after `--` for `storm exec`.
14
14
  - A **runner run** runs the command in a **runner sandbox**, a Vercel Sandbox. This is the default.
15
15
  - A **local run** runs the command on this machine. Add `--local` to make a local run.
16
- - A **run id** is the name of a run, such as `20261103T192655-8277`. It is the start time of the run in UTC and a short suffix. `storm run` prints it at the end, in the `logs` line. With `--json`, the result gives it as `runId`.
16
+ - A **run id** is the name of a run, such as `20261103T192655-8277`. It is the start time of the run in UTC and a short suffix. `storm vitest` and `storm exec` print it at the end, in the `logs` line. With `--json`, the result gives it as `runId`.
17
17
  - A **run directory** is the directory where a run writes what it did, on the machine that started the run. This is true for a runner run and for a local run. Its name is the run id. Do not read its files directly. Use the `runs` commands.
18
18
  - A run is **active** while it goes on. A run is **finished** when it has ended and saved its test results. `runs show` shows test results only for a finished run.
19
19
  - A **test result** is the final result of one test: `pass`, `fail` or `skip`, with its errors. The command saves test results only with the Vitest adapter's `stormReporter`.
@@ -22,7 +22,8 @@ commands: all
22
22
 
23
23
  ## Commands
24
24
 
25
- - `storm run -- <command>` runs a command.
25
+ - `storm vitest [<vitest run args>...] [-- <vitest dash options>...]` counts the tests, then runs `vitest run` with the arguments. Put the dash options of vitest, such as `-t` or `--project`, after `--`.
26
+ - `storm exec -- <command>` runs a different command. It does not count tests.
26
27
  - `storm runs list --json` lists the recent runs.
27
28
  - `storm runs show <run-id> --json` shows a run, its test results, and with `--failed` or `--test` the errors and test output of tests.
28
29
  - `storm runs logs <run-id>` prints a run log.
@@ -52,7 +52,7 @@ In a runner run, storm installs and builds before it runs the command.
52
52
  A runner run can keep its runner sandbox running after it ends.
53
53
 
54
54
  1. Run `storm runs show <run-id> --json`.
55
- 2. Read `where.keptMinutesLeft`. If it is `null` or 0, the runner sandbox is not running. Start a new run with `storm run`.
55
+ 2. Read `where.keptMinutesLeft`. If it is `null` or 0, the runner sandbox is not running. Start a new run with `storm vitest` or `storm exec`.
56
56
  3. Read `where.sandboxUrl`. Give a person the Connect page, `<sandboxUrl>/connect`. In it, a person can run one test again.
57
57
 
58
58
  ## When a command fails