headlamp 0.1.14 → 0.1.16
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 +28 -0
- package/dist/cli.cjs +100 -26
- package/dist/cli.cjs.map +2 -2
- package/dist/index.js +100 -26
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ var init_args = __esm({
|
|
|
53
53
|
coverageUi: (value) => ({ type: "coverageUi", value }),
|
|
54
54
|
coverageAbortOnFailure: (value) => ({ type: "coverageAbortOnFailure", value }),
|
|
55
55
|
onlyFailures: (value) => ({ type: "onlyFailures", value }),
|
|
56
|
+
showConsole: (value) => ({ type: "showConsole", value }),
|
|
56
57
|
jestArg: (value) => ({ type: "jestArg", value }),
|
|
57
58
|
jestArgs: (values) => ({ type: "jestArgs", values }),
|
|
58
59
|
vitestArg: (value) => ({ type: "vitestArg", value }),
|
|
@@ -69,7 +70,8 @@ var init_args = __esm({
|
|
|
69
70
|
coverageMaxFiles: (value) => ({ type: "coverageMaxFiles", value }),
|
|
70
71
|
coverageMaxHotspots: (value) => ({ type: "coverageMaxHotspots", value }),
|
|
71
72
|
coveragePageFit: (value) => ({ type: "coveragePageFit", value }),
|
|
72
|
-
changed: (value) => ({ type: "changed", value })
|
|
73
|
+
changed: (value) => ({ type: "changed", value }),
|
|
74
|
+
changedDepth: (value) => ({ type: "changedDepth", value })
|
|
73
75
|
};
|
|
74
76
|
Some = (value) => ({ _tag: "some", value });
|
|
75
77
|
None = { _tag: "none" };
|
|
@@ -218,6 +220,18 @@ var init_args = __esm({
|
|
|
218
220
|
"--onlyFailures",
|
|
219
221
|
(_flag, lookahead) => step([ActionBuilders.onlyFailures(isTruthy(String(lookahead)))], true)
|
|
220
222
|
),
|
|
223
|
+
// --showConsole flag (boolean)
|
|
224
|
+
rule.eq("--showConsole", () => step([ActionBuilders.showConsole(true)])),
|
|
225
|
+
rule.startsWith(
|
|
226
|
+
"--showConsole=",
|
|
227
|
+
(value) => step([
|
|
228
|
+
ActionBuilders.showConsole(isTruthy((value.split("=")[1] ?? "").trim().toLowerCase()))
|
|
229
|
+
])
|
|
230
|
+
),
|
|
231
|
+
rule.withLookahead(
|
|
232
|
+
"--showConsole",
|
|
233
|
+
(_flag, lookahead) => step([ActionBuilders.showConsole(isTruthy(String(lookahead)))], true)
|
|
234
|
+
),
|
|
221
235
|
rule.withLookahead(
|
|
222
236
|
"--testPathPattern",
|
|
223
237
|
(flag, lookahead) => step([ActionBuilders.jestArgs([flag, lookahead])], true)
|
|
@@ -290,6 +304,16 @@ var init_args = __esm({
|
|
|
290
304
|
const mode = raw === "staged" ? "staged" : raw === "unstaged" ? "unstaged" : raw === "branch" ? "branch" : "all";
|
|
291
305
|
return step([ActionBuilders.changed(mode)], true);
|
|
292
306
|
}),
|
|
307
|
+
// --changed.depth flag: maximum transitive import depth for changed selection refinement
|
|
308
|
+
rule.startsWith("--changed.depth=", (value) => {
|
|
309
|
+
const raw = (value.split("=")[1] ?? "").trim();
|
|
310
|
+
const num = Number(raw);
|
|
311
|
+
return step(Number.isFinite(num) && num > 0 ? [ActionBuilders.changedDepth(num)] : []);
|
|
312
|
+
}),
|
|
313
|
+
rule.withLookahead("--changed.depth", (_flag, lookahead) => {
|
|
314
|
+
const num = Number(String(lookahead).trim());
|
|
315
|
+
return step(Number.isFinite(num) && num > 0 ? [ActionBuilders.changedDepth(num)] : [], true);
|
|
316
|
+
}),
|
|
293
317
|
rule.withLookahead(
|
|
294
318
|
"-t",
|
|
295
319
|
(flag, lookahead) => step(
|
|
@@ -366,6 +390,8 @@ var init_args = __esm({
|
|
|
366
390
|
return { vitest: [], jest: [], coverage: false, coverageAbortOnFailure: action.value };
|
|
367
391
|
case "onlyFailures":
|
|
368
392
|
return { vitest: [], jest: [], coverage: false, onlyFailures: action.value };
|
|
393
|
+
case "showConsole":
|
|
394
|
+
return { vitest: [], jest: [], coverage: false, showConsole: action.value };
|
|
369
395
|
case "jestArgs":
|
|
370
396
|
return { vitest: [], jest: action.values, coverage: false };
|
|
371
397
|
case "selectionHint":
|
|
@@ -396,6 +422,8 @@ var init_args = __esm({
|
|
|
396
422
|
return { vitest: [], jest: [], coverage: false, coveragePageFit: action.value };
|
|
397
423
|
case "changed":
|
|
398
424
|
return { vitest: [], jest: [], coverage: false, changed: action.value };
|
|
425
|
+
case "changedDepth":
|
|
426
|
+
return { vitest: [], jest: [], coverage: false, changedDepth: action.value };
|
|
399
427
|
case "jestArg":
|
|
400
428
|
return { vitest: [], jest: [action.value], coverage: false };
|
|
401
429
|
case "vitestArg":
|
|
@@ -436,8 +464,10 @@ var init_args = __esm({
|
|
|
436
464
|
return {
|
|
437
465
|
...next,
|
|
438
466
|
...right.changed !== void 0 || left.changed !== void 0 ? { changed: right.changed ?? left.changed } : {},
|
|
467
|
+
...right.changedDepth !== void 0 || left.changedDepth !== void 0 ? { changedDepth: right.changedDepth ?? left.changedDepth } : {},
|
|
439
468
|
...right.coverageAbortOnFailure !== void 0 || left.coverageAbortOnFailure !== void 0 ? { coverageAbortOnFailure: right.coverageAbortOnFailure ?? left.coverageAbortOnFailure } : {},
|
|
440
469
|
...right.onlyFailures !== void 0 || left.onlyFailures !== void 0 ? { onlyFailures: right.onlyFailures ?? left.onlyFailures } : {},
|
|
470
|
+
...right.showConsole !== void 0 || left.showConsole !== void 0 ? { showConsole: right.showConsole ?? left.showConsole } : {},
|
|
441
471
|
...right.coverageDetail !== void 0 || left.coverageDetail !== void 0 ? { coverageDetail: right.coverageDetail ?? left.coverageDetail } : {},
|
|
442
472
|
...right.coverageShowCode !== void 0 || left.coverageShowCode !== void 0 ? { coverageShowCode: right.coverageShowCode ?? left.coverageShowCode } : {},
|
|
443
473
|
...right.coverageMode !== void 0 || left.coverageMode !== void 0 ? { coverageMode: right.coverageMode ?? left.coverageMode } : {},
|
|
@@ -462,6 +492,7 @@ var init_args = __esm({
|
|
|
462
492
|
let coverageUi = "both";
|
|
463
493
|
let coverageAbortOnFailure = false;
|
|
464
494
|
let onlyFailures = false;
|
|
495
|
+
let showConsole = false;
|
|
465
496
|
let coverageShowCode = Boolean(process.stdout.isTTY);
|
|
466
497
|
let coverageMode = "auto";
|
|
467
498
|
const coverageMaxFilesLocalInit = void 0;
|
|
@@ -480,6 +511,7 @@ var init_args = __esm({
|
|
|
480
511
|
coverageUi = contrib.coverageUi ?? coverageUi;
|
|
481
512
|
coverageAbortOnFailure = contrib.coverageAbortOnFailure ?? coverageAbortOnFailure;
|
|
482
513
|
onlyFailures = contrib.onlyFailures ?? onlyFailures;
|
|
514
|
+
showConsole = contrib.showConsole ?? showConsole;
|
|
483
515
|
coverageShowCode = contrib.coverageShowCode ?? coverageShowCode;
|
|
484
516
|
const coverageDetailComputed = contrib.coverageDetail ?? (contrib.selection ? "auto" : void 0);
|
|
485
517
|
coverageMode = contrib.coverageMode ?? (contrib.selection ? "compact" : "auto");
|
|
@@ -514,6 +546,7 @@ var init_args = __esm({
|
|
|
514
546
|
coverageUi,
|
|
515
547
|
coverageAbortOnFailure,
|
|
516
548
|
onlyFailures,
|
|
549
|
+
showConsole,
|
|
517
550
|
selectionSpecified: Boolean(contrib.selection),
|
|
518
551
|
selectionPaths: [...contrib.selectionPaths ?? []],
|
|
519
552
|
includeGlobs,
|
|
@@ -526,7 +559,8 @@ var init_args = __esm({
|
|
|
526
559
|
coveragePageFit,
|
|
527
560
|
...contrib.editorCmd !== void 0 ? { editorCmd: contrib.editorCmd } : {},
|
|
528
561
|
...contrib.workspaceRoot !== void 0 ? { workspaceRoot: contrib.workspaceRoot } : {},
|
|
529
|
-
...contrib.changed !== void 0 ? { changed: contrib.changed } : {}
|
|
562
|
+
...contrib.changed !== void 0 ? { changed: contrib.changed } : {},
|
|
563
|
+
...contrib.changedDepth !== void 0 ? { changedDepth: contrib.changedDepth } : {}
|
|
530
564
|
};
|
|
531
565
|
return out;
|
|
532
566
|
};
|
|
@@ -6288,24 +6322,43 @@ var buildStackSection = (mergedForStack, ctx, fallbackLoc) => {
|
|
|
6288
6322
|
};
|
|
6289
6323
|
var MAX_CONSOLE_ERRORS_TO_SHOW = 3;
|
|
6290
6324
|
var isConsoleEntry = (candidate) => typeof candidate === "object" && candidate !== null;
|
|
6291
|
-
var buildConsoleSection = (maybeConsole) => {
|
|
6325
|
+
var buildConsoleSection = (maybeConsole, opts) => {
|
|
6292
6326
|
const out = [];
|
|
6293
6327
|
if (!Array.isArray(maybeConsole)) {
|
|
6294
6328
|
return out;
|
|
6295
6329
|
}
|
|
6296
6330
|
const entries = maybeConsole.filter(isConsoleEntry);
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6331
|
+
if (opts?.full) {
|
|
6332
|
+
const toMsg = (entry) => {
|
|
6333
|
+
const type = String(entry?.type ?? "").toLowerCase();
|
|
6334
|
+
const raw = entry?.message;
|
|
6335
|
+
const msg = Array.isArray(raw) ? raw.map(String).join(" ") : typeof raw === "string" ? raw : String(raw ?? "");
|
|
6336
|
+
const origin = String(entry?.origin ?? "");
|
|
6337
|
+
const typeFmt = type ? `${ansi.white(type)}: ` : "";
|
|
6338
|
+
const originFmt = origin ? ` ${ansi.dim(`(${origin})`)}` : "";
|
|
6339
|
+
return ` ${ansi.dim("\u2022")} ${typeFmt}${msg}${originFmt}`;
|
|
6340
|
+
};
|
|
6341
|
+
const lines = entries.map(toMsg).filter((ln) => stripAnsiSimple(ln).trim().length > 0);
|
|
6342
|
+
if (lines.length) {
|
|
6343
|
+
out.push(ansi.dim(" Logs:"));
|
|
6344
|
+
out.push(...lines, "");
|
|
6345
|
+
}
|
|
6346
|
+
} else {
|
|
6347
|
+
const errorsOnly = entries.filter(
|
|
6348
|
+
(entry) => String(entry?.type ?? "").toLowerCase() === "error"
|
|
6349
|
+
);
|
|
6350
|
+
const scored = errorsOnly.map((entry) => {
|
|
6351
|
+
const raw = entry?.message;
|
|
6352
|
+
const msg = Array.isArray(raw) ? raw.map(String).join(" ") : typeof raw === "string" ? raw : String(raw ?? "");
|
|
6353
|
+
return { msg, score: msg.length };
|
|
6354
|
+
}).filter((item) => item.msg.trim().length > 0).sort((left, right) => right.score - left.score).slice(0, MAX_CONSOLE_ERRORS_TO_SHOW);
|
|
6355
|
+
if (scored.length) {
|
|
6356
|
+
out.push(ansi.dim(" Console errors:"));
|
|
6357
|
+
for (const item of scored) {
|
|
6358
|
+
out.push(` ${ansi.dim("\u2022")} ${item.msg}`);
|
|
6359
|
+
}
|
|
6360
|
+
out.push("");
|
|
6307
6361
|
}
|
|
6308
|
-
out.push("");
|
|
6309
6362
|
}
|
|
6310
6363
|
return out;
|
|
6311
6364
|
};
|
|
@@ -6367,8 +6420,8 @@ var buildThrownSection = (details) => {
|
|
|
6367
6420
|
}
|
|
6368
6421
|
};
|
|
6369
6422
|
const candidates = [];
|
|
6370
|
-
for (const
|
|
6371
|
-
const obj =
|
|
6423
|
+
for (const detailEntry of details) {
|
|
6424
|
+
const obj = detailEntry && typeof detailEntry === "object" ? detailEntry : null;
|
|
6372
6425
|
if (obj && obj.error && typeof obj.error === "object") {
|
|
6373
6426
|
const err = obj.error;
|
|
6374
6427
|
if (typeof err.name === "string") {
|
|
@@ -6565,7 +6618,7 @@ var renderChunks = (chunks, ctx, fns, opts) => {
|
|
|
6565
6618
|
|
|
6566
6619
|
// src/lib/formatter/context.ts
|
|
6567
6620
|
import * as fs5 from "node:fs";
|
|
6568
|
-
var makeCtx = (opts, showStacks = false) => {
|
|
6621
|
+
var makeCtx = (opts, showStacks = false, showConsole = false) => {
|
|
6569
6622
|
const cwd = (opts?.cwd ?? process.cwd()).replace(/\\/g, "/");
|
|
6570
6623
|
const width = Math.max(
|
|
6571
6624
|
40,
|
|
@@ -6581,7 +6634,15 @@ var makeCtx = (opts, showStacks = false) => {
|
|
|
6581
6634
|
return [];
|
|
6582
6635
|
}
|
|
6583
6636
|
};
|
|
6584
|
-
return {
|
|
6637
|
+
return {
|
|
6638
|
+
cwd,
|
|
6639
|
+
width,
|
|
6640
|
+
showStacks,
|
|
6641
|
+
showConsole,
|
|
6642
|
+
projectHint,
|
|
6643
|
+
editorCmd: opts?.editorCmd,
|
|
6644
|
+
readSource: readSource2
|
|
6645
|
+
};
|
|
6585
6646
|
};
|
|
6586
6647
|
|
|
6587
6648
|
// src/lib/formatter/bridge/tryBridgeFallback.ts
|
|
@@ -6903,7 +6964,9 @@ var renderFileLevelFailure = (file, ctx) => {
|
|
|
6903
6964
|
suppressDiff: pretty.length > 0,
|
|
6904
6965
|
stackPreview
|
|
6905
6966
|
});
|
|
6906
|
-
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null)
|
|
6967
|
+
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null), {
|
|
6968
|
+
full: Boolean(ctx.showConsole)
|
|
6969
|
+
});
|
|
6907
6970
|
const stackTail = ctx.showStacks && stackPreview.length === 0 ? (() => {
|
|
6908
6971
|
const tail = mergedForStack.filter((ln) => isStackLine(stripAnsiSimple(ln))).slice(-4).map((ln) => ` ${colorStackLine(String(ln), ctx.projectHint)}`);
|
|
6909
6972
|
return tail.length ? [ansi.dim(" Stack:"), ...tail, ""] : empty;
|
|
@@ -7218,7 +7281,9 @@ var renderFailedAssertion = (args) => {
|
|
|
7218
7281
|
return empty;
|
|
7219
7282
|
}
|
|
7220
7283
|
})() : empty;
|
|
7221
|
-
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null)
|
|
7284
|
+
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null), {
|
|
7285
|
+
full: Boolean(ctx.showConsole)
|
|
7286
|
+
});
|
|
7222
7287
|
const stackTail = ctx.showStacks && stackPreview.length === 0 ? (() => {
|
|
7223
7288
|
const merged = collapseStacks([...msgLines, ...details.stacks]);
|
|
7224
7289
|
const tail = collapseStacks(merged).filter((ln) => isStackLine(stripAnsiSimple(ln))).slice(-4).map((ln) => ` ${colorStackLine(String(ln), ctx.projectHint)}`);
|
|
@@ -7315,7 +7380,11 @@ var formatJestOutputVitest = (raw, opts) => pipe(
|
|
|
7315
7380
|
{ raw, opts },
|
|
7316
7381
|
(state) => ({
|
|
7317
7382
|
...state,
|
|
7318
|
-
ctx: makeCtx(
|
|
7383
|
+
ctx: makeCtx(
|
|
7384
|
+
state.opts,
|
|
7385
|
+
/\bFAIL\b/.test(stripAnsiSimple(state.raw)),
|
|
7386
|
+
Boolean(state.opts?.showConsole)
|
|
7387
|
+
)
|
|
7319
7388
|
}),
|
|
7320
7389
|
(state) => ({ ...state, chunks: parseChunks(state.raw) }),
|
|
7321
7390
|
(state) => ({
|
|
@@ -8020,6 +8089,7 @@ var program = async () => {
|
|
|
8020
8089
|
coverageUi,
|
|
8021
8090
|
coverageAbortOnFailure,
|
|
8022
8091
|
onlyFailures,
|
|
8092
|
+
showConsole,
|
|
8023
8093
|
selectionSpecified,
|
|
8024
8094
|
selectionPaths,
|
|
8025
8095
|
includeGlobs,
|
|
@@ -8032,7 +8102,8 @@ var program = async () => {
|
|
|
8032
8102
|
coverageMaxFiles: coverageMaxFilesArg,
|
|
8033
8103
|
coverageMaxHotspots: coverageMaxHotspotsArg,
|
|
8034
8104
|
coveragePageFit,
|
|
8035
|
-
changed
|
|
8105
|
+
changed,
|
|
8106
|
+
changedDepth
|
|
8036
8107
|
} = deriveArgs(argv);
|
|
8037
8108
|
const getChangedFiles = async (mode, cwd) => {
|
|
8038
8109
|
const collect = async (cmd, args) => {
|
|
@@ -8504,7 +8575,7 @@ var program = async () => {
|
|
|
8504
8575
|
resolutionCache.set(key, resolved);
|
|
8505
8576
|
return resolved;
|
|
8506
8577
|
};
|
|
8507
|
-
const MAX_DEPTH = 5;
|
|
8578
|
+
const MAX_DEPTH = Number.isFinite(Number(changedDepth)) && Number(changedDepth) > 0 ? Number(changedDepth) : 5;
|
|
8508
8579
|
const seen = /* @__PURE__ */ new Set();
|
|
8509
8580
|
const matchesTransitively = async (absTestPath, depth) => {
|
|
8510
8581
|
if (depth > MAX_DEPTH) {
|
|
@@ -8721,7 +8792,8 @@ var program = async () => {
|
|
|
8721
8792
|
reordered,
|
|
8722
8793
|
makeCtx(
|
|
8723
8794
|
{ cwd: repoRootForDiscovery, ...editorCmd !== void 0 ? { editorCmd } : {} },
|
|
8724
|
-
/\bFAIL\b/.test(stripAnsiSimple(output))
|
|
8795
|
+
/\bFAIL\b/.test(stripAnsiSimple(output)),
|
|
8796
|
+
Boolean(showConsole)
|
|
8725
8797
|
),
|
|
8726
8798
|
{ onlyFailures }
|
|
8727
8799
|
);
|
|
@@ -8730,7 +8802,8 @@ var program = async () => {
|
|
|
8730
8802
|
bridge,
|
|
8731
8803
|
makeCtx(
|
|
8732
8804
|
{ cwd: repoRootForDiscovery, ...editorCmd !== void 0 ? { editorCmd } : {} },
|
|
8733
|
-
/\bFAIL\b/.test(stripAnsiSimple(output))
|
|
8805
|
+
/\bFAIL\b/.test(stripAnsiSimple(output)),
|
|
8806
|
+
Boolean(showConsole)
|
|
8734
8807
|
),
|
|
8735
8808
|
{ onlyFailures }
|
|
8736
8809
|
);
|
|
@@ -8832,7 +8905,8 @@ ${stripFooter(rawAlso)}`.trimEnd();
|
|
|
8832
8905
|
unified,
|
|
8833
8906
|
makeCtx(
|
|
8834
8907
|
{ cwd: repoRootForDiscovery, ...editorCmd !== void 0 ? { editorCmd } : {} },
|
|
8835
|
-
showStacks
|
|
8908
|
+
showStacks,
|
|
8909
|
+
Boolean(showConsole)
|
|
8836
8910
|
),
|
|
8837
8911
|
{ onlyFailures }
|
|
8838
8912
|
);
|