headlamp 0.1.8 → 0.1.9
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.
- package/README.md +17 -0
- package/dist/cli.cjs +44 -10
- package/dist/cli.cjs.map +2 -2
- package/dist/index.js +44 -10
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ var init_args = __esm({
|
|
|
52
52
|
coverage: (coverageValue) => ({ type: "coverage", coverageValue }),
|
|
53
53
|
coverageUi: (value) => ({ type: "coverageUi", value }),
|
|
54
54
|
coverageAbortOnFailure: (value) => ({ type: "coverageAbortOnFailure", value }),
|
|
55
|
+
onlyFailures: (value) => ({ type: "onlyFailures", value }),
|
|
55
56
|
jestArg: (value) => ({ type: "jestArg", value }),
|
|
56
57
|
jestArgs: (values) => ({ type: "jestArgs", values }),
|
|
57
58
|
vitestArg: (value) => ({ type: "vitestArg", value }),
|
|
@@ -205,6 +206,18 @@ var init_args = __esm({
|
|
|
205
206
|
"--coverage.pageFit",
|
|
206
207
|
(_flag, lookahead) => step([ActionBuilders.coveragePageFit(isTruthy(String(lookahead)))], true)
|
|
207
208
|
),
|
|
209
|
+
// --onlyFailures flag (boolean)
|
|
210
|
+
rule.eq("--onlyFailures", () => step([ActionBuilders.onlyFailures(true)])),
|
|
211
|
+
rule.startsWith(
|
|
212
|
+
"--onlyFailures=",
|
|
213
|
+
(value) => step([
|
|
214
|
+
ActionBuilders.onlyFailures(isTruthy((value.split("=")[1] ?? "").trim().toLowerCase()))
|
|
215
|
+
])
|
|
216
|
+
),
|
|
217
|
+
rule.withLookahead(
|
|
218
|
+
"--onlyFailures",
|
|
219
|
+
(_flag, lookahead) => step([ActionBuilders.onlyFailures(isTruthy(String(lookahead)))], true)
|
|
220
|
+
),
|
|
208
221
|
rule.withLookahead(
|
|
209
222
|
"--testPathPattern",
|
|
210
223
|
(flag, lookahead) => step([ActionBuilders.jestArgs([flag, lookahead])], true)
|
|
@@ -351,6 +364,8 @@ var init_args = __esm({
|
|
|
351
364
|
return { vitest: [], jest: [], coverage: false, coverageUi: action.value };
|
|
352
365
|
case "coverageAbortOnFailure":
|
|
353
366
|
return { vitest: [], jest: [], coverage: false, coverageAbortOnFailure: action.value };
|
|
367
|
+
case "onlyFailures":
|
|
368
|
+
return { vitest: [], jest: [], coverage: false, onlyFailures: action.value };
|
|
354
369
|
case "jestArgs":
|
|
355
370
|
return { vitest: [], jest: action.values, coverage: false };
|
|
356
371
|
case "selectionHint":
|
|
@@ -422,6 +437,7 @@ var init_args = __esm({
|
|
|
422
437
|
...next,
|
|
423
438
|
...right.changed !== void 0 || left.changed !== void 0 ? { changed: right.changed ?? left.changed } : {},
|
|
424
439
|
...right.coverageAbortOnFailure !== void 0 || left.coverageAbortOnFailure !== void 0 ? { coverageAbortOnFailure: right.coverageAbortOnFailure ?? left.coverageAbortOnFailure } : {},
|
|
440
|
+
...right.onlyFailures !== void 0 || left.onlyFailures !== void 0 ? { onlyFailures: right.onlyFailures ?? left.onlyFailures } : {},
|
|
425
441
|
...right.coverageDetail !== void 0 || left.coverageDetail !== void 0 ? { coverageDetail: right.coverageDetail ?? left.coverageDetail } : {},
|
|
426
442
|
...right.coverageShowCode !== void 0 || left.coverageShowCode !== void 0 ? { coverageShowCode: right.coverageShowCode ?? left.coverageShowCode } : {},
|
|
427
443
|
...right.coverageMode !== void 0 || left.coverageMode !== void 0 ? { coverageMode: right.coverageMode ?? left.coverageMode } : {},
|
|
@@ -445,6 +461,7 @@ var init_args = __esm({
|
|
|
445
461
|
let collectCoverage = false;
|
|
446
462
|
let coverageUi = "both";
|
|
447
463
|
let coverageAbortOnFailure = false;
|
|
464
|
+
let onlyFailures = false;
|
|
448
465
|
let coverageShowCode = Boolean(process.stdout.isTTY);
|
|
449
466
|
let coverageMode = "auto";
|
|
450
467
|
const coverageMaxFilesLocalInit = void 0;
|
|
@@ -462,6 +479,7 @@ var init_args = __esm({
|
|
|
462
479
|
collectCoverage ||= contrib.coverage;
|
|
463
480
|
coverageUi = contrib.coverageUi ?? coverageUi;
|
|
464
481
|
coverageAbortOnFailure = contrib.coverageAbortOnFailure ?? coverageAbortOnFailure;
|
|
482
|
+
onlyFailures = contrib.onlyFailures ?? onlyFailures;
|
|
465
483
|
coverageShowCode = contrib.coverageShowCode ?? coverageShowCode;
|
|
466
484
|
const coverageDetailComputed = contrib.coverageDetail ?? (contrib.selection ? "auto" : void 0);
|
|
467
485
|
coverageMode = contrib.coverageMode ?? (contrib.selection ? "compact" : "auto");
|
|
@@ -495,6 +513,7 @@ var init_args = __esm({
|
|
|
495
513
|
collectCoverage,
|
|
496
514
|
coverageUi,
|
|
497
515
|
coverageAbortOnFailure,
|
|
516
|
+
onlyFailures,
|
|
498
517
|
selectionSpecified: Boolean(contrib.selection),
|
|
499
518
|
selectionPaths: [...contrib.selectionPaths ?? []],
|
|
500
519
|
includeGlobs,
|
|
@@ -6280,6 +6299,7 @@ var formatJestOutputVitest = (raw, opts) => {
|
|
|
6280
6299
|
const projectHint = new RegExp(
|
|
6281
6300
|
`(${cwd.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\$&")})|(/gigworx-node/)`
|
|
6282
6301
|
);
|
|
6302
|
+
const onlyFailures = Boolean(opts?.onlyFailures);
|
|
6283
6303
|
const lines = raw.split(/\r?\n/);
|
|
6284
6304
|
const out = [];
|
|
6285
6305
|
const seenFailures = /* @__PURE__ */ new Set();
|
|
@@ -6367,8 +6387,10 @@ var formatJestOutputVitest = (raw, opts) => {
|
|
|
6367
6387
|
continue;
|
|
6368
6388
|
}
|
|
6369
6389
|
seenFiles.add(rel);
|
|
6370
|
-
|
|
6371
|
-
|
|
6390
|
+
if (!(onlyFailures && badge === "PASS")) {
|
|
6391
|
+
const pill = badge === "PASS" ? colorTokens.passPill("PASS") : colorTokens.failPill("FAIL");
|
|
6392
|
+
out.push(`${pill} ${ansi.white(rel)}`);
|
|
6393
|
+
}
|
|
6372
6394
|
lineIndex += 1;
|
|
6373
6395
|
continue;
|
|
6374
6396
|
}
|
|
@@ -6481,14 +6503,21 @@ function renderVitestFromJestJSON(data, opts) {
|
|
|
6481
6503
|
`(${cwd.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\$&")})|(/gigworx-node/)`
|
|
6482
6504
|
);
|
|
6483
6505
|
const ctx = { projectHint, editorCmd: opts?.editorCmd, showStacks: true };
|
|
6506
|
+
const onlyFailures = Boolean(opts?.onlyFailures);
|
|
6484
6507
|
const out = [];
|
|
6485
|
-
|
|
6486
|
-
|
|
6508
|
+
if (!onlyFailures) {
|
|
6509
|
+
out.push(renderRunLine(cwd));
|
|
6510
|
+
out.push("");
|
|
6511
|
+
}
|
|
6487
6512
|
for (const file of data.testResults) {
|
|
6488
6513
|
const rel = file.testFilePath.replace(/\\/g, "/").replace(`${cwd}/`, "");
|
|
6489
6514
|
const failed = file.testResults.filter((assertion) => assertion.status === "failed");
|
|
6490
|
-
|
|
6491
|
-
|
|
6515
|
+
if (!onlyFailures) {
|
|
6516
|
+
out.push(...buildPerFileOverview(rel, file.testResults));
|
|
6517
|
+
}
|
|
6518
|
+
if (!(onlyFailures && failed.length === 0)) {
|
|
6519
|
+
out.push(buildFileBadgeLine(rel, failed.length));
|
|
6520
|
+
}
|
|
6492
6521
|
if (file.failureMessage && failed.length === 0) {
|
|
6493
6522
|
const lines = file.failureMessage.split(/\r?\n/);
|
|
6494
6523
|
const details = linesFromDetails(file.failureDetails);
|
|
@@ -6886,6 +6915,7 @@ var program = async () => {
|
|
|
6886
6915
|
collectCoverage,
|
|
6887
6916
|
coverageUi,
|
|
6888
6917
|
coverageAbortOnFailure,
|
|
6918
|
+
onlyFailures,
|
|
6889
6919
|
selectionSpecified,
|
|
6890
6920
|
selectionPaths,
|
|
6891
6921
|
includeGlobs,
|
|
@@ -7502,12 +7532,14 @@ var program = async () => {
|
|
|
7502
7532
|
};
|
|
7503
7533
|
pretty = renderVitestFromJestJSON(reordered, {
|
|
7504
7534
|
cwd: repoRootForDiscovery,
|
|
7505
|
-
...editorCmd !== void 0 ? { editorCmd } : {}
|
|
7535
|
+
...editorCmd !== void 0 ? { editorCmd } : {},
|
|
7536
|
+
onlyFailures
|
|
7506
7537
|
});
|
|
7507
7538
|
} catch {
|
|
7508
7539
|
pretty = renderVitestFromJestJSON(bridge, {
|
|
7509
7540
|
cwd: repoRootForDiscovery,
|
|
7510
|
-
...editorCmd !== void 0 ? { editorCmd } : {}
|
|
7541
|
+
...editorCmd !== void 0 ? { editorCmd } : {},
|
|
7542
|
+
onlyFailures
|
|
7511
7543
|
});
|
|
7512
7544
|
}
|
|
7513
7545
|
if (debug) {
|
|
@@ -7524,7 +7556,8 @@ ${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`);
|
|
|
7524
7556
|
}
|
|
7525
7557
|
const renderOpts = {
|
|
7526
7558
|
cwd: repoRootForDiscovery,
|
|
7527
|
-
...editorCmd !== void 0 ? { editorCmd } : {}
|
|
7559
|
+
...editorCmd !== void 0 ? { editorCmd } : {},
|
|
7560
|
+
onlyFailures
|
|
7528
7561
|
};
|
|
7529
7562
|
pretty = formatJestOutputVitest(output, renderOpts);
|
|
7530
7563
|
if (debug) {
|
|
@@ -7590,7 +7623,8 @@ ${preview}${pretty.includes("\n") ? "\n\u2026" : ""}`);
|
|
|
7590
7623
|
}
|
|
7591
7624
|
const text = renderVitestFromJestJSON(unified, {
|
|
7592
7625
|
cwd: repoRootForDiscovery,
|
|
7593
|
-
...editorCmd !== void 0 ? { editorCmd } : {}
|
|
7626
|
+
...editorCmd !== void 0 ? { editorCmd } : {},
|
|
7627
|
+
onlyFailures
|
|
7594
7628
|
});
|
|
7595
7629
|
if (text.trim().length > 0) {
|
|
7596
7630
|
process.stdout.write(text.endsWith("\n") ? text : `${text}
|