bivium 0.9.0 → 0.10.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.
@@ -0,0 +1,549 @@
1
+ import {
2
+ isDumb2,
3
+ SEPARATOR2,
4
+ closingLine2,
5
+ failLine2,
6
+ truncateWords2,
7
+ truncatePath2,
8
+ textWidth2,
9
+ MEASURE2,
10
+ RULE2,
11
+ aligned2,
12
+ headerRow2,
13
+ plural2,
14
+ SILENT2,
15
+ createProgress2
16
+ } from "./shared-a8ebfhzf.js";
17
+ import {
18
+ BiviumError2,
19
+ didYouMean2
20
+ } from "./shared-118ck8qt.js";
21
+ import {
22
+ usageError2,
23
+ json2
24
+ } from "./shared-ke52sg37.js";
25
+ import"./shared-px5a17nj.js";
26
+ import {
27
+ formatSelection,
28
+ computePlan2,
29
+ prepare2
30
+ } from "./shared-70w84x4c.js";
31
+ import {
32
+ duration
33
+ } from "./shared-yfvpkeff.js";
34
+ import {
35
+ githubOutputPath,
36
+ nowMs,
37
+ environment
38
+ } from "./shared-graedbt1.js";
39
+
40
+ // src/commands.ts
41
+ import { spawn } from "node:child_process";
42
+ import {
43
+ appendFileSync,
44
+ mkdtempSync,
45
+ realpathSync,
46
+ rmSync,
47
+ writeFileSync
48
+ } from "node:fs";
49
+ import { tmpdir } from "node:os";
50
+ import {
51
+ basename,
52
+ dirname,
53
+ isAbsolute,
54
+ join,
55
+ posix,
56
+ relative,
57
+ resolve
58
+ } from "node:path";
59
+ var WHITESPACE = /\s+/;
60
+ var CASES_VARIABLE = "BIVIUM_CASES";
61
+ function commandFor(run, files) {
62
+ const words = run.split(WHITESPACE).filter(Boolean);
63
+ const at = words.indexOf("{files}");
64
+ if (at === -1)
65
+ return [...words, ...files];
66
+ return [...words.slice(0, at), ...files, ...words.slice(at + 1)];
67
+ }
68
+ function logSelection(label, selection, total, forced) {
69
+ const files = total === 1 ? "file" : "files";
70
+ let count;
71
+ if (selection.mode === "some") {
72
+ count = `${selection.files.length} of ${total} ${files}`;
73
+ } else if (selection.mode === "none")
74
+ count = "none";
75
+ else if (forced)
76
+ count = "all (full run)";
77
+ else
78
+ count = `all ${total} ${files} (each reaches a change)`;
79
+ console.log(`${label}: ${count}`);
80
+ if (selection.mode === "some") {
81
+ for (const file of selection.files)
82
+ console.log(` ${file}`);
83
+ }
84
+ }
85
+ async function logContext(base, config, computed) {
86
+ const mergeBase = (await computed.mergeBase()).slice(0, 7);
87
+ const count = computed.changed.length;
88
+ const changed = `${count} changed ${count === 1 ? "file" : "files"}`;
89
+ const file = config.file ? `, config ${config.file}` : "";
90
+ console.log(`Against ${base} (merge base ${mergeBase}): ${changed}${file}`);
91
+ }
92
+ function caseNotes({ plan }, only) {
93
+ return Object.entries(plan.cases).flatMap(([name, tests]) => only === undefined || name === only ? Object.entries(tests).map(([test, cases]) => `${test} runs ${cases.length} of ${plural2(plan.caseTotals.get(test) ?? cases.length, "case")}: ${cases.join(" ")}`) : []);
94
+ }
95
+ function logPlan(computed) {
96
+ const { plan, narrowed } = computed;
97
+ for (const reason of plan.reasons)
98
+ console.log(`Full run: ${reason}`);
99
+ for (const line of plan.packages)
100
+ console.log(line);
101
+ for (const line of plan.settings)
102
+ console.log(line);
103
+ for (const line of caseNotes(computed))
104
+ console.log(line);
105
+ for (const line of plan.edits)
106
+ console.log(line);
107
+ for (const { narrower, result } of narrowed) {
108
+ if ("note" in result && result.note) {
109
+ console.log(`${narrower.name}: ${result.note}`);
110
+ }
111
+ }
112
+ for (const [name, selection] of Object.entries(plan.suites)) {
113
+ const total = plan.totals[name] ?? 0;
114
+ logSelection(`${name} tests`, selection, total, plan.full.includes(name));
115
+ }
116
+ }
117
+ function verdictOf(name, selection, total, { plan, changed }, used, paint) {
118
+ const suite = Object.keys(plan.suites).length > 1 ? ` (${name})` : "";
119
+ if (selection.mode === "some") {
120
+ return `${paint.bold(String(selection.files.length))} of ${plural2(total, "test")} run for ${plural2(changed.length, "changed file")}${suite}`;
121
+ }
122
+ if (selection.mode === "none") {
123
+ const why = changed.length === 0 ? "nothing changed" : "no change reaches a test";
124
+ return `no tests run${suite}: ${why}`;
125
+ }
126
+ const cause = plan.full.includes(name) ? plan.causes.find((candidate) => candidate.suites.includes(name)) : undefined;
127
+ if (cause !== undefined)
128
+ used.add(cause);
129
+ const why = plan.full.includes(name) ? cause?.message ?? "a full run" : "each reaches a change";
130
+ const every = total === 1 ? "the 1 test runs" : `all ${total} tests run`;
131
+ return `${every}${suite}: ${why}`;
132
+ }
133
+ function commonDir(files) {
134
+ const [first = ""] = files;
135
+ let prefix = first.slice(0, first.lastIndexOf("/") + 1);
136
+ for (const file of files) {
137
+ while (!file.startsWith(prefix)) {
138
+ prefix = prefix.slice(0, prefix.lastIndexOf("/", prefix.length - 2) + 1);
139
+ }
140
+ }
141
+ return prefix;
142
+ }
143
+ function dirOf(file, prefix) {
144
+ const slash = file.indexOf("/", prefix.length);
145
+ return slash === -1 ? `${prefix}*` : file.slice(0, slash + 1);
146
+ }
147
+ function countTable(paint, { plan }) {
148
+ const suites = Object.entries(plan.suites).flatMap(([name, selection]) => selection.mode === "some" ? [{ name, files: selection.files }] : []);
149
+ const prefix = commonDir(suites.flatMap(({ files }) => files));
150
+ const counts = new Map;
151
+ for (const [i, { files }] of suites.entries()) {
152
+ for (const file of files) {
153
+ const dir = dirOf(file, prefix);
154
+ const row = counts.get(dir) ?? suites.map(() => 0);
155
+ row[i] = (row[i] ?? 0) + 1;
156
+ counts.set(dir, row);
157
+ }
158
+ }
159
+ if (counts.size < 2)
160
+ return [];
161
+ const sum = (row) => row.reduce((a, b) => a + b, 0);
162
+ const rows = [...counts].sort(([a, x], [b, y]) => sum(y) - sum(x) || (a < b ? -1 : 1));
163
+ const several = Object.keys(plan.suites).length > 1;
164
+ const heads = several ? suites.map(({ name }) => name) : ["tests"];
165
+ const right = heads.map((_, i) => i + 1);
166
+ return aligned2([
167
+ headerRow2(paint, ["directory", ...heads]),
168
+ ...rows.map(([dir, row]) => [truncatePath2(dir, 48), ...row.map(String)]),
169
+ ["", ...heads.map(() => RULE2)],
170
+ [
171
+ paint.dim(plural2(rows.length, "directory", "directories")),
172
+ ...suites.map(({ files }) => String(files.length))
173
+ ]
174
+ ], right, paint.dim);
175
+ }
176
+ async function showPlan(out, base, config, computed) {
177
+ const { paint } = out;
178
+ const { plan, narrowed } = computed;
179
+ const used = new Set;
180
+ const lines = [];
181
+ let planned = 0;
182
+ for (const [name, selection] of Object.entries(plan.suites)) {
183
+ const total = plan.totals[name] ?? 0;
184
+ lines.push(verdictOf(name, selection, total, computed, used, paint));
185
+ if (selection.mode === "some")
186
+ planned += selection.files.length;
187
+ if (selection.mode === "all")
188
+ planned += total;
189
+ }
190
+ const mergeBase = (await computed.mergeBase()).slice(0, 7);
191
+ const notes = [
192
+ [
193
+ `since ${base} (merge base ${mergeBase})`,
194
+ ...config.file ? [`config ${config.file}`] : []
195
+ ].join(SEPARATOR2),
196
+ ...plan.causes.filter((cause) => !used.has(cause)).map((cause) => `full run: ${cause.message}`),
197
+ ...plan.packages,
198
+ ...plan.settings,
199
+ ...caseNotes(computed),
200
+ ...plan.edits,
201
+ ...narrowed.flatMap(({ narrower, result }) => ("note" in result) && result.note ? [`${narrower.name}: ${result.note}`] : [])
202
+ ];
203
+ lines.push(...notes.map((note) => paint.dim(truncateWords2(note, MEASURE2))));
204
+ const table = countTable(paint, computed);
205
+ if (table.length > 0)
206
+ lines.push("", ...table);
207
+ const some = Object.values(plan.suites).some(({ mode }) => mode === "some");
208
+ const cost = duration(nowMs() - out.startMs);
209
+ lines.push("", closingLine2(paint, `Planned ${plural2(planned, "test")}`, some ? `${cost}${SEPARATOR2}--list for the files` : cost));
210
+ console.log(lines.join(`
211
+ `));
212
+ }
213
+ function githubOutput() {
214
+ const output = githubOutputPath();
215
+ if (!output) {
216
+ throw usageError2("BV_NO_GITHUB_OUTPUT", "bivium plan: --github writes to $GITHUB_OUTPUT, which is not set (it is in a GitHub Actions step)");
217
+ }
218
+ return output;
219
+ }
220
+ function writeOutputs(output, config, { plan }) {
221
+ const lines = config.suites.map((suite) => {
222
+ const selection = plan.suites[suite.name];
223
+ if (selection === undefined) {
224
+ throw new BiviumError2("BV_INTERNAL", `bivium: plan: no selection for suite "${suite.name}".`);
225
+ }
226
+ const cases = plan.caseLists.get(suite.name);
227
+ return `${suite.output}=${formatSelection(selection)}
228
+ ${cases ? `${suite.name}-cases=${cases.join(" ")}
229
+ ` : ""}`;
230
+ });
231
+ appendFileSync(output, lines.join(""));
232
+ }
233
+ function findSuite(config, name) {
234
+ if (name === undefined)
235
+ return;
236
+ const suite = config.suites.find((candidate) => candidate.name === name);
237
+ if (suite)
238
+ return suite;
239
+ const names = config.suites.map((candidate) => candidate.name);
240
+ throw usageError2("BV_UNKNOWN_SUITE", `bivium: no suite "${name}"${didYouMean2(name, names)}; the config has ${names.join(", ")}`);
241
+ }
242
+ function real(path) {
243
+ try {
244
+ return realpathSync(path);
245
+ } catch {
246
+ const parent = dirname(path);
247
+ return parent === path ? path : join(real(parent), basename(path));
248
+ }
249
+ }
250
+ function repoPath(root, arg, known) {
251
+ const absolute = resolve(arg);
252
+ const realRoot = real(root);
253
+ const mappings = [
254
+ relative(root, absolute),
255
+ relative(realRoot, join(real(dirname(absolute)), basename(absolute))),
256
+ relative(realRoot, real(absolute))
257
+ ].map((path) => path.split("\\").join("/")).filter((path) => !(path.startsWith("..") || isAbsolute(path)));
258
+ const fromCwd = mappings.find(known) ?? mappings[0];
259
+ if (isAbsolute(arg))
260
+ return fromCwd ?? arg;
261
+ const asWritten = posix.normalize(arg.split("\\").join("/"));
262
+ if (known(asWritten))
263
+ return asWritten;
264
+ return fromCwd !== undefined && known(fromCwd) ? fromCwd : asWritten;
265
+ }
266
+ async function inspect(command, { flags, positional }, out) {
267
+ const [{ check, failed, formatReport, summarize }, why] = await Promise.all([
268
+ import("./shared-qe34axez.js"),
269
+ import("./shared-84c9vs8a.js")
270
+ ]);
271
+ const format = flags.get("--format") ?? "tree";
272
+ if (format !== "json" && !why.isFormat(format)) {
273
+ throw usageError2("BV_BAD_OPTION_VALUE", `bivium why: --format takes tree, chain, source or json${didYouMean2(format, ["tree", "chain", "source", "json"])}`);
274
+ }
275
+ const maxFlag = flags.get("--max-unknown");
276
+ const max = maxFlag === undefined ? undefined : Number(maxFlag);
277
+ if (max !== undefined && !Number.isInteger(max)) {
278
+ throw usageError2("BV_BAD_OPTION_VALUE", "bivium check: --max-unknown takes a whole number");
279
+ }
280
+ const [testArg] = positional;
281
+ if (command === "why" && testArg === undefined) {
282
+ throw usageError2("BV_MISSING_ARGUMENT", "bivium why: which test? bivium why <test> [file]");
283
+ }
284
+ const progress = command === "check" && out.io.stderr && !isDumb2(out.io.env) && !out.agent && !flags.has("--json") ? createProgress2(out.io.writeError, out.errorPaint, nowMs) : SILENT2;
285
+ progress.step("building the graph", 0);
286
+ try {
287
+ const { root, base, config } = await prepare2({
288
+ cwd: flags.get("--cwd"),
289
+ base: flags.get("--base") ?? (command === "check" ? "HEAD" : undefined),
290
+ configFile: flags.get("--config")
291
+ });
292
+ const computed = await computePlan2(root, base, config, {
293
+ ...flags.has("--no-cache") && { cache: false }
294
+ });
295
+ if (command === "check") {
296
+ const report = await check(root, config, computed, (what, done) => progress.step(what, done));
297
+ progress.clear();
298
+ const ok = !failed(report, max);
299
+ console.log(flags.has("--json") ? json2({ ok, summary: summarize(report), ...report }) : formatReport(report, max, {
300
+ paint: out.paint,
301
+ all: flags.has("--all"),
302
+ elapsedMs: nowMs() - out.startMs
303
+ }));
304
+ return ok ? 0 : 1;
305
+ }
306
+ return await whyCommand(root, config, computed, flags, positional, out);
307
+ } catch (error) {
308
+ progress.clear();
309
+ throw error;
310
+ }
311
+ }
312
+ async function whyCommand(root, config, computed, flags, [testArg, fileArg], out) {
313
+ const { explain, formatExplanation, isFormat } = await import("./shared-84c9vs8a.js");
314
+ const format = flags.get("--format") ?? "tree";
315
+ const inGraph = (path) => computed.graph.has(path);
316
+ const isTest = (path) => config.suites.some((suite) => suite.isTest(path));
317
+ const test = repoPath(root, testArg ?? "", (path) => inGraph(path) && isTest(path));
318
+ const file = fileArg === undefined ? undefined : repoPath(root, fileArg, inGraph);
319
+ if (!isTest(test) || !inGraph(test)) {
320
+ const tests = [...computed.graph.keys()].filter(isTest);
321
+ throw usageError2(inGraph(test) ? "BV_UNKNOWN_TEST" : "BV_UNKNOWN_FILE", inGraph(test) ? `bivium why: ${test} is no suite's test: name a test first, as in bivium why <test> ${test}` : `bivium why: no test ${test}${didYouMean2(test, tests)}`);
322
+ }
323
+ if (file !== undefined && !inGraph(file)) {
324
+ throw usageError2("BV_UNKNOWN_FILE", `bivium why: no file ${file}${didYouMean2(file, computed.graph.keys())}`);
325
+ }
326
+ const explanation = await explain(root, config, computed, test, file, {
327
+ all: flags.has("--all")
328
+ });
329
+ console.log(flags.has("--json") || format === "json" ? json2(explanation) : formatExplanation(explanation, isFormat(format) ? format : "tree", out.paint));
330
+ return 0;
331
+ }
332
+ async function graphCommand({ flags }) {
333
+ const top = Number(flags.get("--top") ?? "10");
334
+ if (!Number.isInteger(top) || top < 0) {
335
+ throw usageError2("BV_BAD_OPTION_VALUE", "bivium graph: --top takes a whole number");
336
+ }
337
+ const { root, base, config } = await prepare2({
338
+ cwd: flags.get("--cwd"),
339
+ base: "HEAD",
340
+ configFile: flags.get("--config")
341
+ });
342
+ const one = findSuite(config, flags.get("--suite"));
343
+ const suites = one ? [one] : config.suites;
344
+ const { graph } = await computePlan2(root, base, config, {
345
+ ...flags.has("--no-cache") && { cache: false }
346
+ });
347
+ const { formatGraph, graphReport } = await import("./shared-v5gfq9zy.js");
348
+ const report = graphReport(graph, suites);
349
+ console.log(flags.has("--json") ? json2(report) : formatGraph(report, top));
350
+ return 0;
351
+ }
352
+ async function runCommand(command, { flags, positional }, out) {
353
+ const output = flags.has("--github") ? githubOutput() : undefined;
354
+ const { root, base, config } = await prepare2({
355
+ cwd: flags.get("--cwd"),
356
+ base: positional[0],
357
+ configFile: flags.get("--config")
358
+ });
359
+ const suite = findSuite(config, flags.get("--suite")) ?? config.suites[0];
360
+ if (suite === undefined) {
361
+ throw new BiviumError2("BV_CONFIG_INVALID", "bivium config: no suites");
362
+ }
363
+ if (command === "run" && !suite.run) {
364
+ throw usageError2("BV_NO_RUN_COMMAND", `bivium run: suite "${suite.name}" has no run command: add suites.${suite.name}.run to the config`);
365
+ }
366
+ const computed = await computePlan2(root, base, config, {
367
+ ...flags.has("--no-cache") && { cache: false },
368
+ ...command === "run" && { suites: [suite.name] },
369
+ mergeBase: true
370
+ });
371
+ if (command === "plan") {
372
+ if (flags.has("--json")) {
373
+ const { suites, cases, reasons, causes, totals, packages } = computed.plan;
374
+ const narrowed = computed.narrowed.map((ran) => ({
375
+ name: ran.narrower.name,
376
+ result: ran.result
377
+ }));
378
+ console.log(json2({
379
+ base,
380
+ mergeBase: await computed.mergeBase(),
381
+ config: config.file,
382
+ changed: computed.changed,
383
+ suites,
384
+ cases,
385
+ reasons,
386
+ causes,
387
+ totals,
388
+ packages,
389
+ narrowed
390
+ }));
391
+ } else if (out.io.stdout && !out.agent && !flags.has("--list")) {
392
+ await showPlan(out, base, config, computed);
393
+ } else {
394
+ await logContext(base, config, computed);
395
+ logPlan(computed);
396
+ }
397
+ if (output !== undefined)
398
+ writeOutputs(output, config, computed);
399
+ return 0;
400
+ }
401
+ const human = out.io.stdout && !out.agent;
402
+ const others = flags.has("--suite") ? [] : config.suites.slice(1).map((s) => `--suite=${s.name}`);
403
+ if (human)
404
+ await showRun(out, base, config, computed, suite.name, others);
405
+ else {
406
+ await logContext(base, config, computed);
407
+ logPlan(computed);
408
+ }
409
+ const selection = computed.plan.suites[suite.name];
410
+ if (selection === undefined || selection.mode === "none") {
411
+ if (human) {
412
+ console.log(closingLine2(out.paint, `Nothing to run for ${suite.name}`));
413
+ } else {
414
+ console.log(`No ${suite.name} tests affected against ${base}; skipping.`);
415
+ }
416
+ return 0;
417
+ }
418
+ const [program, ...args] = selection.mode === "some" ? commandFor(suite.run ?? "", selection.files) : suite.runAll !== undefined ? commandFor(suite.runAll, []) : commandFor(suite.run ?? "", suite.roots.filter((root) => root !== "."));
419
+ if (program === undefined) {
420
+ throw usageError2("BV_NO_RUN_COMMAND", `bivium run: suite "${suite.name}" has no run command: add suites.${suite.name}.run to the config`);
421
+ }
422
+ if (human) {
423
+ const files = selection.mode === "some" ? selection.files.length : 0;
424
+ const bare = commandFor(suite.run ?? "", []);
425
+ console.log(`${out.paint.dim(shownCommand([program, ...args], bare, files))}
426
+ `);
427
+ }
428
+ const cases = computed.plan.caseLists.get(suite.name);
429
+ if (cases === undefined) {
430
+ return await runSuite(program, args, root, suite.name, out, human);
431
+ }
432
+ const dir = mkdtempSync(join(tmpdir(), "bivium-cases-"));
433
+ try {
434
+ const file = join(dir, "cases.txt");
435
+ writeFileSync(file, `${cases.join(`
436
+ `)}
437
+ `);
438
+ const env = { ...environment(), [CASES_VARIABLE]: file };
439
+ return await runSuite(program, args, root, suite.name, out, human, env);
440
+ } finally {
441
+ rmSync(dir, { recursive: true, force: true });
442
+ }
443
+ }
444
+ var SIGNAL_NAMES = { SIGINT: "Ctrl-C", SIGTERM: "SIGTERM" };
445
+ var PASS_ON_MS = 1000;
446
+ async function runSuite(program, args, root, name, out, human, env) {
447
+ const { EXIT_INTERRUPTED, exitCodeOf, handleInterrupt } = await import("./shared-y7y281x3.js");
448
+ const started = nowMs();
449
+ const child = spawn(program, args, {
450
+ cwd: root,
451
+ stdio: "inherit",
452
+ ...env && { env }
453
+ });
454
+ const ended = new Promise((resolve) => {
455
+ child.once("error", (error) => resolve({ code: null, signal: null, error }));
456
+ child.once("exit", (code, signal) => resolve({ code, signal }));
457
+ });
458
+ let stoppedBy;
459
+ let closed;
460
+ const close = (result) => {
461
+ if (closed !== undefined)
462
+ return closed;
463
+ if (result.error !== undefined) {
464
+ console.error(result.error.code === "ENOENT" ? `bivium run: suite "${name}" runs ${program}, which isn't on PATH; run bivium through bunx, npx or a package script, which put node_modules/.bin on it` : `bivium run: suite "${name}" couldn't start ${program}: ${result.error.message}`);
465
+ closed = 2;
466
+ return closed;
467
+ }
468
+ const by = stoppedBy ?? (result.signal === "SIGINT" || result.code === EXIT_INTERRUPTED ? "SIGINT" : undefined);
469
+ closed = by === "SIGTERM" ? 143 : by === "SIGINT" ? EXIT_INTERRUPTED : result.code ?? 1;
470
+ const took = duration(nowMs() - started);
471
+ if (by !== undefined && !human) {
472
+ out.io.writeError(`bivium run: ${name} stopped by ${SIGNAL_NAMES[by]} after ${took}
473
+ `);
474
+ }
475
+ if (!human)
476
+ return closed;
477
+ console.log(`
478
+ ${by !== undefined ? failLine2(out.paint, `${name} stopped by ${SIGNAL_NAMES[by]}`, took) : closed === 0 ? closingLine2(out.paint, `${name} passed`, took) : failLine2(out.paint, `${name} failed`, `${result.signal ?? `exit ${closed}`}${SEPARATOR2}${took}`)}`);
479
+ return closed;
480
+ };
481
+ const { signals } = out.io;
482
+ if (signals === undefined)
483
+ return close(await ended);
484
+ const interrupt = handleInterrupt({
485
+ process: signals,
486
+ exit: false,
487
+ write: (text) => process.stdout.write(text),
488
+ terminal: out.io.stdout,
489
+ async onStop(signal) {
490
+ stoppedBy = signal;
491
+ if (signal === "SIGTERM")
492
+ child.kill("SIGTERM");
493
+ else {
494
+ const pass = setTimeout(() => child.kill("SIGINT"), PASS_ON_MS);
495
+ pass.unref();
496
+ }
497
+ close(await ended);
498
+ },
499
+ onQuit() {
500
+ child.kill("SIGKILL");
501
+ close({ code: null, signal: "SIGKILL" });
502
+ }
503
+ });
504
+ try {
505
+ const result = await ended;
506
+ const signal = await interrupt.settle();
507
+ if (signal === undefined)
508
+ return close(result);
509
+ await interrupt.stopped;
510
+ return exitCodeOf(signal);
511
+ } finally {
512
+ interrupt.dispose();
513
+ }
514
+ }
515
+ function shownCommand(whole, bare, files) {
516
+ const line = `$ ${whole.join(" ")}`;
517
+ if (textWidth2(line) <= MEASURE2)
518
+ return line;
519
+ const counted = `$ ${bare.join(" ")}${SEPARATOR2}${plural2(files, "file")}`;
520
+ const pointed = `${counted}, as bivium plan --list names them`;
521
+ return textWidth2(pointed) <= MEASURE2 ? pointed : counted;
522
+ }
523
+ async function showRun(out, base, config, computed, name, others) {
524
+ const { paint } = out;
525
+ const selection = computed.plan.suites[name];
526
+ const total = computed.plan.totals[name] ?? 0;
527
+ const used = new Set;
528
+ const verdict = selection === undefined ? `no ${name} tests` : verdictOf(name, selection, total, computed, used, paint);
529
+ const mergeBase = (await computed.mergeBase()).slice(0, 7);
530
+ const context = [
531
+ `since ${base} (merge base ${mergeBase})`,
532
+ ...config.file ? [`config ${config.file}`] : []
533
+ ].join(SEPARATOR2);
534
+ const lines = [
535
+ verdict,
536
+ paint.dim(context),
537
+ ...caseNotes(computed, name).map((note) => paint.dim(truncateWords2(note, MEASURE2)))
538
+ ];
539
+ if (others.length > 0) {
540
+ lines.push(paint.dim(`running ${name}${SEPARATOR2}${plural2(others.length, "more suite")}: ${others.join(", ")}`));
541
+ }
542
+ console.log(lines.join(`
543
+ `));
544
+ }
545
+ export {
546
+ graphCommand,
547
+ inspect,
548
+ runCommand
549
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ fanIn2,
3
+ graphReport2,
4
+ formatGraph2
5
+ } from "./shared-my87dhfd.js";
6
+ import"./shared-px5a17nj.js";
7
+ import"./shared-118ck8qt.js";
8
+ import"./shared-a8ebfhzf.js";
9
+ export {
10
+ fanIn2 as fanIn,
11
+ formatGraph2 as formatGraph,
12
+ graphReport2 as graphReport
13
+ };
@@ -0,0 +1,66 @@
1
+ import {
2
+ PLAIN2,
3
+ createPaint2,
4
+ wantsColor2,
5
+ isDumb2,
6
+ isAgent2,
7
+ UNICODE_GLYPHS2,
8
+ ASCII_GLYPHS2,
9
+ markOf2,
10
+ wantsAscii2,
11
+ hideCursor2,
12
+ showCursor2,
13
+ cursorHidden2,
14
+ SEPARATOR2,
15
+ branch2,
16
+ NOTE_INDENT2,
17
+ closingLine2,
18
+ failLine2,
19
+ keyHints2,
20
+ nearest2,
21
+ truncateWords2,
22
+ truncatePath2,
23
+ textWidth2,
24
+ MEASURE2,
25
+ fitTerminal2,
26
+ fitWidth2,
27
+ RULE2,
28
+ aligned2,
29
+ headerRow2,
30
+ plural2,
31
+ SILENT2,
32
+ createProgress2
33
+ } from "./shared-a8ebfhzf.js";
34
+ export {
35
+ ASCII_GLYPHS2 as ASCII_GLYPHS,
36
+ MEASURE2 as MEASURE,
37
+ NOTE_INDENT2 as NOTE_INDENT,
38
+ PLAIN2 as PLAIN,
39
+ RULE2 as RULE,
40
+ SEPARATOR2 as SEPARATOR,
41
+ SILENT2 as SILENT,
42
+ UNICODE_GLYPHS2 as UNICODE_GLYPHS,
43
+ aligned2 as aligned,
44
+ branch2 as branch,
45
+ closingLine2 as closingLine,
46
+ createPaint2 as createPaint,
47
+ createProgress2 as createProgress,
48
+ cursorHidden2 as cursorHidden,
49
+ failLine2 as failLine,
50
+ fitTerminal2 as fitTerminal,
51
+ fitWidth2 as fitWidth,
52
+ headerRow2 as headerRow,
53
+ hideCursor2 as hideCursor,
54
+ isAgent2 as isAgent,
55
+ isDumb2 as isDumb,
56
+ keyHints2 as keyHints,
57
+ markOf2 as markOf,
58
+ nearest2 as nearest,
59
+ plural2 as plural,
60
+ showCursor2 as showCursor,
61
+ textWidth2 as textWidth,
62
+ truncatePath2 as truncatePath,
63
+ truncateWords2 as truncateWords,
64
+ wantsAscii2 as wantsAscii,
65
+ wantsColor2 as wantsColor
66
+ };
@@ -0,0 +1,4 @@
1
+ // package.json
2
+ var version = "0.10.0";
3
+
4
+ export { version };