headlamp 0.1.24 → 0.1.26
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/dist/cli.cjs +92 -37
- package/dist/cli.cjs.map +3 -3
- package/dist/index.js +92 -37
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3822,7 +3822,7 @@ var require_jiti = __commonJS({
|
|
|
3822
3822
|
}, pathe_M_eThtNZ_dirname = function(p3) {
|
|
3823
3823
|
const segments = pathe_M_eThtNZ_normalizeWindowsPath(p3).replace(/\/$/, "").split("/").slice(0, -1);
|
|
3824
3824
|
return 1 === segments.length && _DRIVE_LETTER_RE2.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute8(p3) ? "/" : ".");
|
|
3825
|
-
},
|
|
3825
|
+
}, basename7 = function(p3, extension) {
|
|
3826
3826
|
const segments = pathe_M_eThtNZ_normalizeWindowsPath(p3).split("/");
|
|
3827
3827
|
let lastSegment = "";
|
|
3828
3828
|
for (let i3 = segments.length - 1; i3 >= 0; i3--) {
|
|
@@ -4528,7 +4528,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
4528
4528
|
if (!ctx.opts.fsCache || !topts.filename) return get();
|
|
4529
4529
|
const sourceHash = ` /* v${CACHE_VERSION}-${hash2(topts.source, 16)} */
|
|
4530
4530
|
`;
|
|
4531
|
-
let cacheName = `${
|
|
4531
|
+
let cacheName = `${basename7(pathe_M_eThtNZ_dirname(topts.filename))}-${function(path16) {
|
|
4532
4532
|
const base = path16.split(utils_SLASH_RE).pop();
|
|
4533
4533
|
if (!base) return;
|
|
4534
4534
|
const separatorIndex = base.lastIndexOf(".");
|
|
@@ -4574,7 +4574,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
4574
4574
|
return code.startsWith("#!") && (code = "// " + code), code;
|
|
4575
4575
|
}
|
|
4576
4576
|
function eval_evalModule(ctx, source, evalOptions = {}) {
|
|
4577
|
-
const id = evalOptions.id || (evalOptions.filename ?
|
|
4577
|
+
const id = evalOptions.id || (evalOptions.filename ? basename7(evalOptions.filename) : `_jitiEval.${evalOptions.ext || (evalOptions.async ? "mjs" : "js")}`), filename = evalOptions.filename || jitiResolve(ctx, id, { async: evalOptions.async }), ext = evalOptions.ext || extname5(filename), cache3 = evalOptions.cache || ctx.parentCache || {}, isTypescript = /\.[cm]?tsx?$/.test(ext), isESM = ".mjs" === ext || ".js" === ext && "module" === function(path16) {
|
|
4578
4578
|
for (; path16 && "." !== path16 && "/" !== path16; ) {
|
|
4579
4579
|
path16 = pathe_M_eThtNZ_join(path16, "..");
|
|
4580
4580
|
try {
|
|
@@ -6029,10 +6029,10 @@ One of the following config files must be in the directory tree: "${_index.ROOT_
|
|
|
6029
6029
|
const parts = _path().resolve(dirname7, pattern).split(_path().sep);
|
|
6030
6030
|
return new RegExp(["^", ...parts.map((part, i2) => {
|
|
6031
6031
|
const last = i2 === parts.length - 1;
|
|
6032
|
-
return "**" === part ? last ? starStarPatLast : starStarPat : "*" === part ? last ? starPatLast : starPat : 0 === part.indexOf("*.") ? substitution + escapeRegExp(part.slice(1)) + (last ? endSep :
|
|
6032
|
+
return "**" === part ? last ? starStarPatLast : starStarPat : "*" === part ? last ? starPatLast : starPat : 0 === part.indexOf("*.") ? substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep3) : escapeRegExp(part) + (last ? endSep : sep3);
|
|
6033
6033
|
})].join(""));
|
|
6034
6034
|
};
|
|
6035
|
-
const
|
|
6035
|
+
const sep3 = `\\${_path().sep}`, endSep = `(?:${sep3}|$)`, substitution = `[^${sep3}]+`, starPat = `(?:${substitution}${sep3})`, starPatLast = `(?:${substitution}${endSep})`, starStarPat = `${starPat}*?`, starStarPatLast = `${starPat}*?${starPatLast}?`;
|
|
6036
6036
|
function escapeRegExp(string) {
|
|
6037
6037
|
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
6038
6038
|
}
|
|
@@ -8943,11 +8943,11 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
8943
8943
|
function maybePrintTrailingCommaOrSemicolon(printer, node) {
|
|
8944
8944
|
printer.tokenMap && node.start && node.end ? printer.tokenMap.endMatches(node, ",") ? printer.token(",") : printer.tokenMap.endMatches(node, ";") && printer.semicolon() : printer.semicolon();
|
|
8945
8945
|
}
|
|
8946
|
-
function tsPrintUnionOrIntersectionType(printer, node,
|
|
8946
|
+
function tsPrintUnionOrIntersectionType(printer, node, sep3) {
|
|
8947
8947
|
var _printer$tokenMap;
|
|
8948
8948
|
let hasLeadingToken = 0;
|
|
8949
|
-
null != (_printer$tokenMap = printer.tokenMap) && _printer$tokenMap.startMatches(node,
|
|
8950
|
-
this.space(), this.token(
|
|
8949
|
+
null != (_printer$tokenMap = printer.tokenMap) && _printer$tokenMap.startMatches(node, sep3) && (hasLeadingToken = 1, printer.token(sep3)), printer.printJoin(node.types, void 0, void 0, function(i2) {
|
|
8950
|
+
this.space(), this.token(sep3, null, i2 + hasLeadingToken), this.space();
|
|
8951
8951
|
});
|
|
8952
8952
|
}
|
|
8953
8953
|
function tokenIfPlusMinus(self2, tok) {
|
|
@@ -22959,8 +22959,8 @@ ${str}
|
|
|
22959
22959
|
}
|
|
22960
22960
|
}
|
|
22961
22961
|
dump() {
|
|
22962
|
-
const
|
|
22963
|
-
console.log(
|
|
22962
|
+
const sep3 = "-".repeat(60);
|
|
22963
|
+
console.log(sep3);
|
|
22964
22964
|
let scope = this;
|
|
22965
22965
|
do {
|
|
22966
22966
|
console.log("#", scope.block.type);
|
|
@@ -22969,7 +22969,7 @@ ${str}
|
|
|
22969
22969
|
console.log(" -", name, { constant: binding.constant, references: binding.references, violations: binding.constantViolations.length, kind: binding.kind });
|
|
22970
22970
|
}
|
|
22971
22971
|
} while (scope = scope.parent);
|
|
22972
|
-
console.log(
|
|
22972
|
+
console.log(sep3);
|
|
22973
22973
|
}
|
|
22974
22974
|
hasLabel(name) {
|
|
22975
22975
|
return !!this.getLabel(name);
|
|
@@ -58034,7 +58034,6 @@ var filterCandidatesForProject = async (cfgPath, jestArgs, candidates, cwd2) =>
|
|
|
58034
58034
|
}
|
|
58035
58035
|
const toPosixNormalized = (inputPath) => inputPath.replace(/\\/g, "/");
|
|
58036
58036
|
const relativePatterns = candidates.map((absOrRel) => path7.isAbsolute(absOrRel) ? path7.relative(cwd2, absOrRel) : absOrRel).map(toPosixNormalized);
|
|
58037
|
-
console.log("relativePatterns:", relativePatterns);
|
|
58038
58037
|
let attemptPatterns = [];
|
|
58039
58038
|
try {
|
|
58040
58039
|
attemptPatterns = await discoverJest([...jestArgs, "--config", cfgPath], {
|
|
@@ -58048,11 +58047,35 @@ var filterCandidatesForProject = async (cfgPath, jestArgs, candidates, cwd2) =>
|
|
|
58048
58047
|
(candidatePath) => toPosixNormalized(candidatePath)
|
|
58049
58048
|
);
|
|
58050
58049
|
if (normalizedAttemptPatterns.length > 0) {
|
|
58050
|
+
console.info(`Selected files \u2192 count=${normalizedAttemptPatterns.length}`);
|
|
58051
|
+
console.info("Selected files \u2192");
|
|
58052
|
+
normalizedAttemptPatterns.forEach((pattern) => console.info(` - ${pattern}`));
|
|
58051
58053
|
return normalizedAttemptPatterns;
|
|
58052
58054
|
}
|
|
58055
|
+
try {
|
|
58056
|
+
const allInProject = await discoverJestResilient([...jestArgs, "--config", cfgPath], {
|
|
58057
|
+
cwd: cwd2
|
|
58058
|
+
});
|
|
58059
|
+
const normalizedAll = allInProject.map((p3) => toPosixNormalized(p3));
|
|
58060
|
+
const bySuffix = normalizedAll.filter(
|
|
58061
|
+
(abs) => relativePatterns.some(
|
|
58062
|
+
(rel) => abs.endsWith(`/${rel}`) || abs.endsWith(rel) || abs.endsWith(`/${rel.split("/").pop()}`)
|
|
58063
|
+
)
|
|
58064
|
+
);
|
|
58065
|
+
if (bySuffix.length > 0) {
|
|
58066
|
+
console.info(`Selected files \u2192 count=${bySuffix.length}`);
|
|
58067
|
+
console.info("Selected files \u2192");
|
|
58068
|
+
bySuffix.forEach((p3) => console.info(` - ${p3}`));
|
|
58069
|
+
return bySuffix;
|
|
58070
|
+
}
|
|
58071
|
+
} catch {
|
|
58072
|
+
}
|
|
58053
58073
|
const absoluteFromRelative = relativePatterns.map(
|
|
58054
58074
|
(rel) => toPosixNormalized(path7.join(cwd2, rel))
|
|
58055
58075
|
);
|
|
58076
|
+
console.info(`Selected files \u2192 count=${absoluteFromRelative.length}`);
|
|
58077
|
+
console.info("Selected files \u2192");
|
|
58078
|
+
absoluteFromRelative.forEach((p3) => console.info(` - ${p3}`));
|
|
58056
58079
|
return absoluteFromRelative;
|
|
58057
58080
|
};
|
|
58058
58081
|
var decideShouldRunJest = (vitestFiles, jestFiles, opts) => {
|
|
@@ -58967,12 +58990,12 @@ var renderPerFileCompositeTable = async (opts) => {
|
|
|
58967
58990
|
}
|
|
58968
58991
|
const table = renderTable(cols, rows);
|
|
58969
58992
|
console.info(table);
|
|
58970
|
-
const
|
|
58993
|
+
const sep3 = ansi.gray(
|
|
58971
58994
|
"\u2500".repeat(
|
|
58972
58995
|
Math.max(20, typeof process.stdout.columns === "number" ? process.stdout.columns : 100)
|
|
58973
58996
|
)
|
|
58974
58997
|
);
|
|
58975
|
-
console.info(
|
|
58998
|
+
console.info(sep3);
|
|
58976
58999
|
};
|
|
58977
59000
|
var printPerFileCompositeTables = async (opts) => {
|
|
58978
59001
|
const selectionAbs = (opts.selectionPaths ?? []).map(
|
|
@@ -61235,7 +61258,6 @@ var DEFAULT_EXCLUDES = [
|
|
|
61235
61258
|
];
|
|
61236
61259
|
var unique = (values) => Array.from(new Set(values));
|
|
61237
61260
|
var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
61238
|
-
const includeGlobs = opts?.includeGlobs ?? [];
|
|
61239
61261
|
const excludeGlobs = unique([...opts?.excludeGlobs ?? [], ...DEFAULT_EXCLUDES]);
|
|
61240
61262
|
const results = /* @__PURE__ */ new Set();
|
|
61241
61263
|
const pushIf = (absPath) => {
|
|
@@ -61243,21 +61265,22 @@ var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
|
61243
61265
|
if (existsFile(norm)) results.add(norm);
|
|
61244
61266
|
};
|
|
61245
61267
|
for (const raw of tokens) {
|
|
61246
|
-
const
|
|
61247
|
-
if (!
|
|
61268
|
+
const tokenRaw = String(raw || "").trim();
|
|
61269
|
+
if (!tokenRaw) {
|
|
61248
61270
|
continue;
|
|
61249
61271
|
}
|
|
61250
|
-
if (path14.isAbsolute(
|
|
61251
|
-
pushIf(
|
|
61272
|
+
if (path14.isAbsolute(tokenRaw)) {
|
|
61273
|
+
pushIf(tokenRaw);
|
|
61252
61274
|
continue;
|
|
61253
61275
|
}
|
|
61254
|
-
if (
|
|
61255
|
-
pushIf(path14.join(repoRoot,
|
|
61276
|
+
if (tokenRaw.startsWith("/")) {
|
|
61277
|
+
pushIf(path14.join(repoRoot, tokenRaw.slice(1)));
|
|
61256
61278
|
}
|
|
61257
|
-
|
|
61258
|
-
|
|
61259
|
-
|
|
61260
|
-
|
|
61279
|
+
const token = tokenRaw.startsWith("/") ? tokenRaw.slice(1) : tokenRaw;
|
|
61280
|
+
const trySearch = async (patterns) => {
|
|
61281
|
+
const args = ["--files"];
|
|
61282
|
+
for (const pat of patterns) {
|
|
61283
|
+
args.push("-g", pat);
|
|
61261
61284
|
}
|
|
61262
61285
|
for (const g3 of excludeGlobs) {
|
|
61263
61286
|
args.push("-g", g3);
|
|
@@ -61268,6 +61291,20 @@ var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
|
61268
61291
|
timeoutMs: 4e3
|
|
61269
61292
|
});
|
|
61270
61293
|
out.split(/\r?\n/).map((ln2) => ln2.trim()).filter(Boolean).map((rel) => toAbsPosix(path14.resolve(repoRoot, rel))).forEach((abs) => results.add(abs));
|
|
61294
|
+
};
|
|
61295
|
+
try {
|
|
61296
|
+
await trySearch([`**/${token}`]);
|
|
61297
|
+
if (![...results].some(
|
|
61298
|
+
(p3) => p3.endsWith(path14.sep + token) || p3.endsWith("/" + token) || p3.endsWith(token)
|
|
61299
|
+
)) {
|
|
61300
|
+
const base = path14.basename(token);
|
|
61301
|
+
if (base && base !== token) {
|
|
61302
|
+
try {
|
|
61303
|
+
await trySearch([`**/${base}`]);
|
|
61304
|
+
} catch {
|
|
61305
|
+
}
|
|
61306
|
+
}
|
|
61307
|
+
}
|
|
61271
61308
|
} catch {
|
|
61272
61309
|
}
|
|
61273
61310
|
}
|
|
@@ -61280,8 +61317,7 @@ var resolveTokens = async (tokens, repoRoot, opts) => {
|
|
|
61280
61317
|
return unique(filtered);
|
|
61281
61318
|
};
|
|
61282
61319
|
var resolveTestSelectionTokens = async (tokens, repoRoot) => resolveTokens(tokens, repoRoot, {
|
|
61283
|
-
onlyTestFiles: true
|
|
61284
|
-
includeGlobs: ["**/*.test.*", "**/*.spec.*", "tests/**/*"]
|
|
61320
|
+
onlyTestFiles: true
|
|
61285
61321
|
});
|
|
61286
61322
|
var resolveProdSelectionTokens = async (tokens, repoRoot) => resolveTokens(tokens, repoRoot, { forbidTestFiles: true });
|
|
61287
61323
|
|
|
@@ -61477,9 +61513,9 @@ var emitMergedCoverage = async (ui2, opts) => {
|
|
|
61477
61513
|
if (/^\s*(Statements|Branches|Functions|Lines)\s*:/.test(lineText)) {
|
|
61478
61514
|
const updated = lineText.replace(
|
|
61479
61515
|
/(Statements|Branches|Functions|Lines)(\s*:\s*)(\d+(?:\.\d+)?)(%)/,
|
|
61480
|
-
(_m, label,
|
|
61516
|
+
(_m, label, sep3, num, pct) => {
|
|
61481
61517
|
const colorize = tintPct(Number(num));
|
|
61482
|
-
return `${colorize(label)}${
|
|
61518
|
+
return `${colorize(label)}${sep3}${colorize(`${num}${pct}`)}`;
|
|
61483
61519
|
}
|
|
61484
61520
|
);
|
|
61485
61521
|
return updated.replace(/\(\s*(\d+)\s*\/\s*(\d+)\s*\)/, (_match, coveredText, totalText) => {
|
|
@@ -61888,7 +61924,7 @@ var program = async () => {
|
|
|
61888
61924
|
`Selection classify \u2192 looksLikePath=${selectionLooksLikePath} looksLikeTest=${selectionLooksLikeTest} prodPaths=${selectionIncludesProdPaths}`
|
|
61889
61925
|
);
|
|
61890
61926
|
const stripPathTokens = (args) => args.filter((token) => !selectionPathsAugmented.includes(token));
|
|
61891
|
-
const jestDiscoveryArgs = selectionIncludesProdPaths ? stripPathTokens(jest) : jest;
|
|
61927
|
+
const jestDiscoveryArgs = selectionIncludesProdPaths || selectionHasPaths && selectionLooksLikeTest ? stripPathTokens(jest) : jest;
|
|
61892
61928
|
const projectConfigs = [];
|
|
61893
61929
|
try {
|
|
61894
61930
|
const baseCfg = path15.resolve("jest.config.js");
|
|
@@ -61903,7 +61939,20 @@ var program = async () => {
|
|
|
61903
61939
|
console.warn(`Failed to discover Jest project configs: ${String(err)}`);
|
|
61904
61940
|
}
|
|
61905
61941
|
const perProjectFiles = /* @__PURE__ */ new Map();
|
|
61906
|
-
if (!namePatternOnlyForDiscovery &&
|
|
61942
|
+
if (!namePatternOnlyForDiscovery && selectionLooksLikeTest && selectionHasPaths) {
|
|
61943
|
+
await Promise.all(
|
|
61944
|
+
projectConfigs.map(async (cfg) => {
|
|
61945
|
+
const cfgCwd = path15.dirname(cfg);
|
|
61946
|
+
const owned = await filterCandidatesForProject(
|
|
61947
|
+
cfg,
|
|
61948
|
+
jestDiscoveryArgs,
|
|
61949
|
+
resolvedSelectionTestPaths,
|
|
61950
|
+
cfgCwd
|
|
61951
|
+
);
|
|
61952
|
+
perProjectFiles.set(cfg, owned);
|
|
61953
|
+
})
|
|
61954
|
+
);
|
|
61955
|
+
} else if (!namePatternOnlyForDiscovery && selectionIncludesProdPaths) {
|
|
61907
61956
|
console.info(
|
|
61908
61957
|
`Discovering (rg-first) \u2192 related=${selectionIncludesProdPaths} | cwd=${repoRootForDiscovery}`
|
|
61909
61958
|
);
|
|
@@ -62016,9 +62065,7 @@ var program = async () => {
|
|
|
62016
62065
|
const perProjectFiltered = /* @__PURE__ */ new Map();
|
|
62017
62066
|
for (const cfg of projectConfigs) {
|
|
62018
62067
|
const files = perProjectFiles.get(cfg) ?? [];
|
|
62019
|
-
const selectionTestPaths = selectionPathsAugmented.filter(
|
|
62020
|
-
(pathToken) => /\.(test|spec)\.[tj]sx?$/i.test(pathToken) || /(^|\/)tests?\//i.test(pathToken)
|
|
62021
|
-
);
|
|
62068
|
+
const selectionTestPaths = selectionPathsAugmented.filter(isTestLikePathToken);
|
|
62022
62069
|
const selectionTestAbs = resolvedSelectionTestPaths.length ? resolvedSelectionTestPaths : selectionTestPaths;
|
|
62023
62070
|
const candidates = selectionHasPaths && selectionLooksLikeTest ? selectionTestAbs : files;
|
|
62024
62071
|
const absFiles = candidates.map(
|
|
@@ -62371,12 +62418,14 @@ var program = async () => {
|
|
|
62371
62418
|
const msg = shouldRunJest ? `Jest selected (${sharePct}% of discovered tests; reason: ${forcedByNamePattern ? "name_pattern" : jestDecision.reason})` : `Skipping Jest (${sharePct}% of discovered tests; reason: ${jestDecision.reason})`;
|
|
62372
62419
|
console.info(`Discovery \u2192 jest: ${jestCount}. ${msg}`);
|
|
62373
62420
|
if (!shouldRunJest) {
|
|
62374
|
-
console.
|
|
62421
|
+
console.info(
|
|
62422
|
+
"No matching tests were discovered for either Vitest or Jest. Treating as success."
|
|
62423
|
+
);
|
|
62375
62424
|
console.info(`Jest args: ${[...jestDiscoveryArgs, "--listTests"].join(" ")}`);
|
|
62376
62425
|
console.info(
|
|
62377
62426
|
"Tip: check your -t/--testNamePattern and file path; Jest lists files selected by your patterns."
|
|
62378
62427
|
);
|
|
62379
|
-
process.exit(
|
|
62428
|
+
process.exit(0);
|
|
62380
62429
|
return;
|
|
62381
62430
|
}
|
|
62382
62431
|
console.info(`Run plan \u2192 Jest maybe=${shouldRunJest} (projects=${projectConfigs.length})`);
|
|
@@ -62386,7 +62435,13 @@ var program = async () => {
|
|
|
62386
62435
|
if (shouldRunJest) {
|
|
62387
62436
|
console.info("Starting Jest (no Vitest targets)\u2026");
|
|
62388
62437
|
await runJestBootstrap(bootstrapCommand);
|
|
62389
|
-
const jestRunArgs = selectionIncludesProdPaths ? stripPathTokens(jestArgs) :
|
|
62438
|
+
const jestRunArgs = selectionIncludesProdPaths ? stripPathTokens(jestArgs) : selectionHasPaths && selectionLooksLikeTest && (resolvedSelectionTestPaths?.length ?? 0) > 0 ? (() => {
|
|
62439
|
+
const base = stripPathTokens(jestArgs);
|
|
62440
|
+
const resolved = (resolvedSelectionTestPaths ?? []).map(
|
|
62441
|
+
(absPath) => path15.resolve(absPath).replace(/\\/g, "/")
|
|
62442
|
+
);
|
|
62443
|
+
return [...base, ...resolved];
|
|
62444
|
+
})() : jestArgs;
|
|
62390
62445
|
const sanitizedJestRunArgs = jestRunArgs.filter(
|
|
62391
62446
|
(arg) => !/^--coverageDirectory(?:=|$)/.test(String(arg))
|
|
62392
62447
|
);
|