@theholocron/kyber 5.0.0-alpha.370 → 5.0.0-alpha.371

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.
@@ -6,7 +6,7 @@ interface CliRun {
6
6
  stdout: string;
7
7
  /** Everything written to stderr. */
8
8
  stderr: string;
9
- /** The exit code; -1 if the process was killed by the timeout. */
9
+ /** The exit code; -1 if a signal ended the process (the timeout, or something else, which `stderr` then says). */
10
10
  code: number;
11
11
  /** True only when the timeout killed the run; `stderr` then ends with a line saying how long it ran and what it printed. */
12
12
  timedOut: boolean;
@@ -19,7 +19,7 @@ interface RunCliOptions {
19
19
  config?: object | string;
20
20
  /** Added to the controlled environment for this run. */
21
21
  env?: Record<string, string>;
22
- /** How long the run may take before it is killed. Default 20 seconds. */
22
+ /** How long the run may take before it is killed. Default 60 seconds. */
23
23
  timeoutMs?: number;
24
24
  }
25
25
  /** What {@link createCliRunner} needs to run a tool's built binary. */
package/dist/testing.mjs CHANGED
@@ -8,6 +8,12 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises";
8
8
  import yargs from "yargs";
9
9
  // src/testing/cli-runner/cli-runner.ts
10
10
  /**
11
+ * How long one run may take by default. A start of the built CLI takes about a second idle and 15 s or more on a
12
+ * machine running every package's tests at once, so the budget is well over that and under the preset's test timeout
13
+ * (`@theholocron/vitest-config`, 120 s), which keeps this runner, the one that can say what happened, the first to give up.
14
+ */
15
+ const DEFAULT_TIMEOUT_MS = 6e4;
16
+ /**
11
17
  * A function that runs a tool's built binary in a fresh temporary directory with a controlled environment, and returns
12
18
  * what it printed and how it exited. The environment is built from nothing: no tokens, no telemetry and no update check
13
19
  * leak in from whoever runs the tests, and stdin is closed, so a command that wants a terminal behaves as it does in CI.
@@ -44,7 +50,7 @@ function createCliRunner(options) {
44
50
  let stderr = "";
45
51
  child.stdout.on("data", (d) => stdout += d);
46
52
  child.stderr.on("data", (d) => stderr += d);
47
- const timeoutMs = run.timeoutMs ?? 2e4;
53
+ const timeoutMs = run.timeoutMs ?? DEFAULT_TIMEOUT_MS;
48
54
  const started = Date.now();
49
55
  let timedOut = false;
50
56
  const timer = setTimeout(() => {
@@ -60,6 +66,11 @@ function createCliRunner(options) {
60
66
  stderr += `\n${note}`;
61
67
  console.error(note);
62
68
  }
69
+ if (!timedOut && signal) {
70
+ const note = `[cli-runner] ended by ${signal} after ${elapsedMs} ms, not by its timeout (${timeoutMs} ms), pid ${child.pid}; args: [${args.join(" ")}]`;
71
+ stderr += `\n${note}`;
72
+ console.error(note);
73
+ }
63
74
  resolve({
64
75
  stdout,
65
76
  stderr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/kyber",
3
- "version": "5.0.0-alpha.370",
3
+ "version": "5.0.0-alpha.371",
4
4
  "description": "The reusable parts of a command-line tool: terminal output, prompts, the interactive menu, the update notifier, safe handling of tokens, a test harness and the global flags.",
5
5
  "keywords": [
6
6
  "cli",
@@ -105,12 +105,12 @@
105
105
  "typescript": "^5.9.3",
106
106
  "vitest": "^5.1.0",
107
107
  "yargs": "^18.1.0",
108
- "@theholocron/datapad": "5.0.0-alpha.370",
109
- "@theholocron/eslint-config": "^8.9.0-alpha.11",
110
- "@theholocron/observability": "0.7.0-alpha.2",
111
- "@theholocron/tsdown-config": "^8.9.0-alpha.11",
112
108
  "@theholocron/tsconfig": "^8.9.0-alpha.11",
113
- "@theholocron/vitest-config": "^8.9.0-alpha.11"
109
+ "@theholocron/tsdown-config": "^8.9.0-alpha.11",
110
+ "@theholocron/vitest-config": "^8.9.0-alpha.11",
111
+ "@theholocron/eslint-config": "^8.9.0-alpha.11",
112
+ "@theholocron/datapad": "5.0.0-alpha.371",
113
+ "@theholocron/observability": "0.7.0-alpha.2"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@inquirer/prompts": "^8.0.0",
@@ -121,7 +121,7 @@
121
121
  "dotenv": "^17.0.0",
122
122
  "ora": "^9.0.0",
123
123
  "yargs": "^18.0.0",
124
- "@theholocron/datapad": "^5.0.0-alpha.370",
124
+ "@theholocron/datapad": "^5.0.0-alpha.371",
125
125
  "@theholocron/observability": "^0.7.0-alpha.2"
126
126
  },
127
127
  "peerDependenciesMeta": {