headlamp 0.1.15 → 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 +16 -0
- package/dist/cli.cjs +80 -22
- package/dist/cli.cjs.map +2 -2
- package/dist/index.js +80 -22
- 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 }),
|
|
@@ -219,6 +220,18 @@ var init_args = __esm({
|
|
|
219
220
|
"--onlyFailures",
|
|
220
221
|
(_flag, lookahead) => step([ActionBuilders.onlyFailures(isTruthy(String(lookahead)))], true)
|
|
221
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
|
+
),
|
|
222
235
|
rule.withLookahead(
|
|
223
236
|
"--testPathPattern",
|
|
224
237
|
(flag, lookahead) => step([ActionBuilders.jestArgs([flag, lookahead])], true)
|
|
@@ -377,6 +390,8 @@ var init_args = __esm({
|
|
|
377
390
|
return { vitest: [], jest: [], coverage: false, coverageAbortOnFailure: action.value };
|
|
378
391
|
case "onlyFailures":
|
|
379
392
|
return { vitest: [], jest: [], coverage: false, onlyFailures: action.value };
|
|
393
|
+
case "showConsole":
|
|
394
|
+
return { vitest: [], jest: [], coverage: false, showConsole: action.value };
|
|
380
395
|
case "jestArgs":
|
|
381
396
|
return { vitest: [], jest: action.values, coverage: false };
|
|
382
397
|
case "selectionHint":
|
|
@@ -452,6 +467,7 @@ var init_args = __esm({
|
|
|
452
467
|
...right.changedDepth !== void 0 || left.changedDepth !== void 0 ? { changedDepth: right.changedDepth ?? left.changedDepth } : {},
|
|
453
468
|
...right.coverageAbortOnFailure !== void 0 || left.coverageAbortOnFailure !== void 0 ? { coverageAbortOnFailure: right.coverageAbortOnFailure ?? left.coverageAbortOnFailure } : {},
|
|
454
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 } : {},
|
|
455
471
|
...right.coverageDetail !== void 0 || left.coverageDetail !== void 0 ? { coverageDetail: right.coverageDetail ?? left.coverageDetail } : {},
|
|
456
472
|
...right.coverageShowCode !== void 0 || left.coverageShowCode !== void 0 ? { coverageShowCode: right.coverageShowCode ?? left.coverageShowCode } : {},
|
|
457
473
|
...right.coverageMode !== void 0 || left.coverageMode !== void 0 ? { coverageMode: right.coverageMode ?? left.coverageMode } : {},
|
|
@@ -476,6 +492,7 @@ var init_args = __esm({
|
|
|
476
492
|
let coverageUi = "both";
|
|
477
493
|
let coverageAbortOnFailure = false;
|
|
478
494
|
let onlyFailures = false;
|
|
495
|
+
let showConsole = false;
|
|
479
496
|
let coverageShowCode = Boolean(process.stdout.isTTY);
|
|
480
497
|
let coverageMode = "auto";
|
|
481
498
|
const coverageMaxFilesLocalInit = void 0;
|
|
@@ -494,6 +511,7 @@ var init_args = __esm({
|
|
|
494
511
|
coverageUi = contrib.coverageUi ?? coverageUi;
|
|
495
512
|
coverageAbortOnFailure = contrib.coverageAbortOnFailure ?? coverageAbortOnFailure;
|
|
496
513
|
onlyFailures = contrib.onlyFailures ?? onlyFailures;
|
|
514
|
+
showConsole = contrib.showConsole ?? showConsole;
|
|
497
515
|
coverageShowCode = contrib.coverageShowCode ?? coverageShowCode;
|
|
498
516
|
const coverageDetailComputed = contrib.coverageDetail ?? (contrib.selection ? "auto" : void 0);
|
|
499
517
|
coverageMode = contrib.coverageMode ?? (contrib.selection ? "compact" : "auto");
|
|
@@ -528,6 +546,7 @@ var init_args = __esm({
|
|
|
528
546
|
coverageUi,
|
|
529
547
|
coverageAbortOnFailure,
|
|
530
548
|
onlyFailures,
|
|
549
|
+
showConsole,
|
|
531
550
|
selectionSpecified: Boolean(contrib.selection),
|
|
532
551
|
selectionPaths: [...contrib.selectionPaths ?? []],
|
|
533
552
|
includeGlobs,
|
|
@@ -6303,24 +6322,43 @@ var buildStackSection = (mergedForStack, ctx, fallbackLoc) => {
|
|
|
6303
6322
|
};
|
|
6304
6323
|
var MAX_CONSOLE_ERRORS_TO_SHOW = 3;
|
|
6305
6324
|
var isConsoleEntry = (candidate) => typeof candidate === "object" && candidate !== null;
|
|
6306
|
-
var buildConsoleSection = (maybeConsole) => {
|
|
6325
|
+
var buildConsoleSection = (maybeConsole, opts) => {
|
|
6307
6326
|
const out = [];
|
|
6308
6327
|
if (!Array.isArray(maybeConsole)) {
|
|
6309
6328
|
return out;
|
|
6310
6329
|
}
|
|
6311
6330
|
const entries = maybeConsole.filter(isConsoleEntry);
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
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("");
|
|
6322
6361
|
}
|
|
6323
|
-
out.push("");
|
|
6324
6362
|
}
|
|
6325
6363
|
return out;
|
|
6326
6364
|
};
|
|
@@ -6382,8 +6420,8 @@ var buildThrownSection = (details) => {
|
|
|
6382
6420
|
}
|
|
6383
6421
|
};
|
|
6384
6422
|
const candidates = [];
|
|
6385
|
-
for (const
|
|
6386
|
-
const obj =
|
|
6423
|
+
for (const detailEntry of details) {
|
|
6424
|
+
const obj = detailEntry && typeof detailEntry === "object" ? detailEntry : null;
|
|
6387
6425
|
if (obj && obj.error && typeof obj.error === "object") {
|
|
6388
6426
|
const err = obj.error;
|
|
6389
6427
|
if (typeof err.name === "string") {
|
|
@@ -6580,7 +6618,7 @@ var renderChunks = (chunks, ctx, fns, opts) => {
|
|
|
6580
6618
|
|
|
6581
6619
|
// src/lib/formatter/context.ts
|
|
6582
6620
|
import * as fs5 from "node:fs";
|
|
6583
|
-
var makeCtx = (opts, showStacks = false) => {
|
|
6621
|
+
var makeCtx = (opts, showStacks = false, showConsole = false) => {
|
|
6584
6622
|
const cwd = (opts?.cwd ?? process.cwd()).replace(/\\/g, "/");
|
|
6585
6623
|
const width = Math.max(
|
|
6586
6624
|
40,
|
|
@@ -6596,7 +6634,15 @@ var makeCtx = (opts, showStacks = false) => {
|
|
|
6596
6634
|
return [];
|
|
6597
6635
|
}
|
|
6598
6636
|
};
|
|
6599
|
-
return {
|
|
6637
|
+
return {
|
|
6638
|
+
cwd,
|
|
6639
|
+
width,
|
|
6640
|
+
showStacks,
|
|
6641
|
+
showConsole,
|
|
6642
|
+
projectHint,
|
|
6643
|
+
editorCmd: opts?.editorCmd,
|
|
6644
|
+
readSource: readSource2
|
|
6645
|
+
};
|
|
6600
6646
|
};
|
|
6601
6647
|
|
|
6602
6648
|
// src/lib/formatter/bridge/tryBridgeFallback.ts
|
|
@@ -6918,7 +6964,9 @@ var renderFileLevelFailure = (file, ctx) => {
|
|
|
6918
6964
|
suppressDiff: pretty.length > 0,
|
|
6919
6965
|
stackPreview
|
|
6920
6966
|
});
|
|
6921
|
-
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null)
|
|
6967
|
+
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null), {
|
|
6968
|
+
full: Boolean(ctx.showConsole)
|
|
6969
|
+
});
|
|
6922
6970
|
const stackTail = ctx.showStacks && stackPreview.length === 0 ? (() => {
|
|
6923
6971
|
const tail = mergedForStack.filter((ln) => isStackLine(stripAnsiSimple(ln))).slice(-4).map((ln) => ` ${colorStackLine(String(ln), ctx.projectHint)}`);
|
|
6924
6972
|
return tail.length ? [ansi.dim(" Stack:"), ...tail, ""] : empty;
|
|
@@ -7233,7 +7281,9 @@ var renderFailedAssertion = (args) => {
|
|
|
7233
7281
|
return empty;
|
|
7234
7282
|
}
|
|
7235
7283
|
})() : empty;
|
|
7236
|
-
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null)
|
|
7284
|
+
const consoleBlock = buildConsoleSection(stripBridgeEventsFromConsole(file.console ?? null), {
|
|
7285
|
+
full: Boolean(ctx.showConsole)
|
|
7286
|
+
});
|
|
7237
7287
|
const stackTail = ctx.showStacks && stackPreview.length === 0 ? (() => {
|
|
7238
7288
|
const merged = collapseStacks([...msgLines, ...details.stacks]);
|
|
7239
7289
|
const tail = collapseStacks(merged).filter((ln) => isStackLine(stripAnsiSimple(ln))).slice(-4).map((ln) => ` ${colorStackLine(String(ln), ctx.projectHint)}`);
|
|
@@ -7330,7 +7380,11 @@ var formatJestOutputVitest = (raw, opts) => pipe(
|
|
|
7330
7380
|
{ raw, opts },
|
|
7331
7381
|
(state) => ({
|
|
7332
7382
|
...state,
|
|
7333
|
-
ctx: makeCtx(
|
|
7383
|
+
ctx: makeCtx(
|
|
7384
|
+
state.opts,
|
|
7385
|
+
/\bFAIL\b/.test(stripAnsiSimple(state.raw)),
|
|
7386
|
+
Boolean(state.opts?.showConsole)
|
|
7387
|
+
)
|
|
7334
7388
|
}),
|
|
7335
7389
|
(state) => ({ ...state, chunks: parseChunks(state.raw) }),
|
|
7336
7390
|
(state) => ({
|
|
@@ -8035,6 +8089,7 @@ var program = async () => {
|
|
|
8035
8089
|
coverageUi,
|
|
8036
8090
|
coverageAbortOnFailure,
|
|
8037
8091
|
onlyFailures,
|
|
8092
|
+
showConsole,
|
|
8038
8093
|
selectionSpecified,
|
|
8039
8094
|
selectionPaths,
|
|
8040
8095
|
includeGlobs,
|
|
@@ -8737,7 +8792,8 @@ var program = async () => {
|
|
|
8737
8792
|
reordered,
|
|
8738
8793
|
makeCtx(
|
|
8739
8794
|
{ cwd: repoRootForDiscovery, ...editorCmd !== void 0 ? { editorCmd } : {} },
|
|
8740
|
-
/\bFAIL\b/.test(stripAnsiSimple(output))
|
|
8795
|
+
/\bFAIL\b/.test(stripAnsiSimple(output)),
|
|
8796
|
+
Boolean(showConsole)
|
|
8741
8797
|
),
|
|
8742
8798
|
{ onlyFailures }
|
|
8743
8799
|
);
|
|
@@ -8746,7 +8802,8 @@ var program = async () => {
|
|
|
8746
8802
|
bridge,
|
|
8747
8803
|
makeCtx(
|
|
8748
8804
|
{ cwd: repoRootForDiscovery, ...editorCmd !== void 0 ? { editorCmd } : {} },
|
|
8749
|
-
/\bFAIL\b/.test(stripAnsiSimple(output))
|
|
8805
|
+
/\bFAIL\b/.test(stripAnsiSimple(output)),
|
|
8806
|
+
Boolean(showConsole)
|
|
8750
8807
|
),
|
|
8751
8808
|
{ onlyFailures }
|
|
8752
8809
|
);
|
|
@@ -8848,7 +8905,8 @@ ${stripFooter(rawAlso)}`.trimEnd();
|
|
|
8848
8905
|
unified,
|
|
8849
8906
|
makeCtx(
|
|
8850
8907
|
{ cwd: repoRootForDiscovery, ...editorCmd !== void 0 ? { editorCmd } : {} },
|
|
8851
|
-
showStacks
|
|
8908
|
+
showStacks,
|
|
8909
|
+
Boolean(showConsole)
|
|
8852
8910
|
),
|
|
8853
8911
|
{ onlyFailures }
|
|
8854
8912
|
);
|