headlamp 0.1.26 → 0.1.27
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 +58 -37
- package/dist/cli.cjs.map +3 -3
- package/dist/index.js +58 -37
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57225,6 +57225,7 @@ init_args();
|
|
|
57225
57225
|
init_fast_related();
|
|
57226
57226
|
import * as path7 from "node:path";
|
|
57227
57227
|
import * as fs3 from "node:fs/promises";
|
|
57228
|
+
import * as fsSync2 from "node:fs";
|
|
57228
57229
|
import * as os3 from "node:os";
|
|
57229
57230
|
import { createHash as createHash3 } from "node:crypto";
|
|
57230
57231
|
|
|
@@ -57909,7 +57910,27 @@ async function discoverJest(jestArgs, opts) {
|
|
|
57909
57910
|
...hasPatterns ? opts.patterns ?? [] : []
|
|
57910
57911
|
];
|
|
57911
57912
|
const jestBin2 = "./node_modules/.bin/jest";
|
|
57912
|
-
const
|
|
57913
|
+
const withAutoConfig = (args, cwd2) => {
|
|
57914
|
+
try {
|
|
57915
|
+
const candidates = [
|
|
57916
|
+
"jest.config.cjs",
|
|
57917
|
+
"jest.config.js",
|
|
57918
|
+
"jest.config.mjs",
|
|
57919
|
+
"jest.config.ts",
|
|
57920
|
+
"jest.ts.config.js",
|
|
57921
|
+
"jest.ts.config.cjs"
|
|
57922
|
+
];
|
|
57923
|
+
for (const name of candidates) {
|
|
57924
|
+
const full = path7.join(cwd2, name);
|
|
57925
|
+
if (fsSync2.existsSync(full) && !args.includes("--config")) {
|
|
57926
|
+
return [...args, "--config", name];
|
|
57927
|
+
}
|
|
57928
|
+
}
|
|
57929
|
+
} catch {
|
|
57930
|
+
}
|
|
57931
|
+
return args;
|
|
57932
|
+
};
|
|
57933
|
+
const raw = await runText(jestBin2, withAutoConfig(listArgs, opts?.cwd ?? process.cwd()), {
|
|
57913
57934
|
cwd: opts?.cwd ?? process.cwd(),
|
|
57914
57935
|
env: safeEnv(process.env, {
|
|
57915
57936
|
CI: "1",
|
|
@@ -58238,7 +58259,7 @@ var compositeBarPct = (summary, hotspots) => {
|
|
|
58238
58259
|
init_env_utils();
|
|
58239
58260
|
init_exec();
|
|
58240
58261
|
import * as path9 from "node:path";
|
|
58241
|
-
import * as
|
|
58262
|
+
import * as fsSync3 from "node:fs";
|
|
58242
58263
|
|
|
58243
58264
|
// src/lib/relevance.ts
|
|
58244
58265
|
init_args();
|
|
@@ -58343,7 +58364,7 @@ var printDetailedCoverage = async (opts) => {
|
|
|
58343
58364
|
let src = "";
|
|
58344
58365
|
if (opts.showCode && topBlocks.length > 0) {
|
|
58345
58366
|
try {
|
|
58346
|
-
src =
|
|
58367
|
+
src = fsSync3.readFileSync(abs, "utf8");
|
|
58347
58368
|
} catch {
|
|
58348
58369
|
src = "";
|
|
58349
58370
|
}
|
|
@@ -60966,7 +60987,7 @@ init_exec();
|
|
|
60966
60987
|
init_args();
|
|
60967
60988
|
import * as path15 from "node:path";
|
|
60968
60989
|
import * as os4 from "node:os";
|
|
60969
|
-
import * as
|
|
60990
|
+
import * as fsSync5 from "node:fs";
|
|
60970
60991
|
import * as fs8 from "node:fs/promises";
|
|
60971
60992
|
import * as LibReport from "istanbul-lib-report";
|
|
60972
60993
|
import * as Reports from "istanbul-reports";
|
|
@@ -61238,11 +61259,11 @@ init_config();
|
|
|
61238
61259
|
init_env_utils();
|
|
61239
61260
|
init_exec();
|
|
61240
61261
|
import * as path14 from "node:path";
|
|
61241
|
-
import * as
|
|
61262
|
+
import * as fsSync4 from "node:fs";
|
|
61242
61263
|
var toAbsPosix = (absPath) => path14.resolve(absPath).replace(/\\/g, "/");
|
|
61243
61264
|
var existsFile = (absPath) => {
|
|
61244
61265
|
try {
|
|
61245
|
-
const stat2 =
|
|
61266
|
+
const stat2 = fsSync4.statSync(absPath);
|
|
61246
61267
|
return stat2.isFile();
|
|
61247
61268
|
} catch {
|
|
61248
61269
|
return false;
|
|
@@ -61361,7 +61382,7 @@ var mergeLcov = async () => {
|
|
|
61361
61382
|
const collectLcovs = (dir) => {
|
|
61362
61383
|
const out = [];
|
|
61363
61384
|
try {
|
|
61364
|
-
const entries =
|
|
61385
|
+
const entries = fsSync5.readdirSync(dir, { withFileTypes: true });
|
|
61365
61386
|
for (const entry of entries) {
|
|
61366
61387
|
const full = path15.join(dir, entry.name);
|
|
61367
61388
|
if (entry.isDirectory()) {
|
|
@@ -61414,7 +61435,7 @@ var emitMergedCoverage = async (ui2, opts) => {
|
|
|
61414
61435
|
const listJsons = (dir) => {
|
|
61415
61436
|
const out = [];
|
|
61416
61437
|
try {
|
|
61417
|
-
const entries =
|
|
61438
|
+
const entries = fsSync5.readdirSync(dir, { withFileTypes: true });
|
|
61418
61439
|
for (const entry of entries) {
|
|
61419
61440
|
const full = path15.join(dir, entry.name);
|
|
61420
61441
|
if (entry.isDirectory()) {
|
|
@@ -61433,7 +61454,7 @@ var emitMergedCoverage = async (ui2, opts) => {
|
|
|
61433
61454
|
...listJsons(coverageRoot)
|
|
61434
61455
|
].map((candidatePath) => path15.resolve(candidatePath)).filter((absolutePath, index, arr) => {
|
|
61435
61456
|
const isFirst = arr.indexOf(absolutePath) === index;
|
|
61436
|
-
const exists =
|
|
61457
|
+
const exists = fsSync5.existsSync(absolutePath);
|
|
61437
61458
|
return isFirst && exists;
|
|
61438
61459
|
});
|
|
61439
61460
|
for (const jsonPath of jsonCandidates) {
|
|
@@ -61564,22 +61585,22 @@ var emitMergedCoverage = async (ui2, opts) => {
|
|
|
61564
61585
|
const textPath = path15.resolve("coverage", "merged", "coverage.txt");
|
|
61565
61586
|
const summaryPath = path15.resolve("coverage", "merged", "coverage-summary.txt");
|
|
61566
61587
|
const filesToPrint = [];
|
|
61567
|
-
if (
|
|
61588
|
+
if (fsSync5.existsSync(textPath)) {
|
|
61568
61589
|
filesToPrint.push(textPath);
|
|
61569
61590
|
}
|
|
61570
|
-
if (
|
|
61591
|
+
if (fsSync5.existsSync(summaryPath)) {
|
|
61571
61592
|
filesToPrint.push(summaryPath);
|
|
61572
61593
|
}
|
|
61573
61594
|
if (filesToPrint.length > 0) {
|
|
61574
61595
|
for (const filePath of filesToPrint) {
|
|
61575
61596
|
try {
|
|
61576
|
-
const raw =
|
|
61597
|
+
const raw = fsSync5.readFileSync(filePath, "utf8");
|
|
61577
61598
|
const colored = raw.split(/\r?\n/).map(colorizeIstanbulLine).join("\n");
|
|
61578
61599
|
process.stdout.write(colored.endsWith("\n") ? colored : `${colored}
|
|
61579
61600
|
`);
|
|
61580
61601
|
} catch {
|
|
61581
61602
|
try {
|
|
61582
|
-
const raw =
|
|
61603
|
+
const raw = fsSync5.readFileSync(filePath, "utf8");
|
|
61583
61604
|
process.stdout.write(raw.endsWith("\n") ? raw : `${raw}
|
|
61584
61605
|
`);
|
|
61585
61606
|
} catch {
|
|
@@ -61882,15 +61903,15 @@ var program = async () => {
|
|
|
61882
61903
|
const tryPushIfProd = (absPath) => {
|
|
61883
61904
|
const norm = path15.resolve(absPath).replace(/\\/g, "/");
|
|
61884
61905
|
const isTest = /(^|\/)tests?\//i.test(norm) || /\.(test|spec)\.[tj]sx?$/i.test(norm);
|
|
61885
|
-
if (!isTest &&
|
|
61906
|
+
if (!isTest && fsSync5.existsSync(norm)) {
|
|
61886
61907
|
results.add(norm);
|
|
61887
61908
|
}
|
|
61888
61909
|
};
|
|
61889
|
-
if (isAbs &&
|
|
61910
|
+
if (isAbs && fsSync5.existsSync(token)) {
|
|
61890
61911
|
tryPushIfProd(token);
|
|
61891
61912
|
continue;
|
|
61892
61913
|
}
|
|
61893
|
-
if (candidateFromRoot &&
|
|
61914
|
+
if (candidateFromRoot && fsSync5.existsSync(candidateFromRoot)) {
|
|
61894
61915
|
tryPushIfProd(candidateFromRoot);
|
|
61895
61916
|
continue;
|
|
61896
61917
|
}
|
|
@@ -61929,10 +61950,10 @@ var program = async () => {
|
|
|
61929
61950
|
try {
|
|
61930
61951
|
const baseCfg = path15.resolve("jest.config.js");
|
|
61931
61952
|
const tsCfg = path15.resolve("jest.ts.config.js");
|
|
61932
|
-
if (
|
|
61953
|
+
if (fsSync5.existsSync(baseCfg)) {
|
|
61933
61954
|
projectConfigs.push(baseCfg);
|
|
61934
61955
|
}
|
|
61935
|
-
if (
|
|
61956
|
+
if (fsSync5.existsSync(tsCfg)) {
|
|
61936
61957
|
projectConfigs.push(tsCfg);
|
|
61937
61958
|
}
|
|
61938
61959
|
} catch (err) {
|
|
@@ -62149,7 +62170,7 @@ var program = async () => {
|
|
|
62149
62170
|
const includesSeed = (text) => seeds.some((seed) => text.includes(seed));
|
|
62150
62171
|
const tryRead = (filePath) => {
|
|
62151
62172
|
try {
|
|
62152
|
-
return
|
|
62173
|
+
return fsSync5.readFileSync(filePath, "utf8");
|
|
62153
62174
|
} catch {
|
|
62154
62175
|
return "";
|
|
62155
62176
|
}
|
|
@@ -62160,13 +62181,13 @@ var program = async () => {
|
|
|
62160
62181
|
const exts = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
62161
62182
|
for (const ext of exts) {
|
|
62162
62183
|
const full = ext ? `${cand}${ext}` : cand;
|
|
62163
|
-
if (
|
|
62184
|
+
if (fsSync5.existsSync(full)) {
|
|
62164
62185
|
return full;
|
|
62165
62186
|
}
|
|
62166
62187
|
}
|
|
62167
62188
|
for (const ext of exts) {
|
|
62168
62189
|
const full = path15.join(cand, `index${ext}`);
|
|
62169
|
-
if (
|
|
62190
|
+
if (fsSync5.existsSync(full)) {
|
|
62170
62191
|
return full;
|
|
62171
62192
|
}
|
|
62172
62193
|
}
|
|
@@ -62284,13 +62305,13 @@ var program = async () => {
|
|
|
62284
62305
|
const extensions = ["", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"];
|
|
62285
62306
|
for (const ext of extensions) {
|
|
62286
62307
|
const fullPath = ext ? `${candidate}${ext}` : candidate;
|
|
62287
|
-
if (
|
|
62308
|
+
if (fsSync5.existsSync(fullPath)) {
|
|
62288
62309
|
return fullPath;
|
|
62289
62310
|
}
|
|
62290
62311
|
}
|
|
62291
62312
|
for (const ext of extensions) {
|
|
62292
62313
|
const fullPath = path15.join(candidate, `index${ext}`);
|
|
62293
|
-
if (
|
|
62314
|
+
if (fsSync5.existsSync(fullPath)) {
|
|
62294
62315
|
return fullPath;
|
|
62295
62316
|
}
|
|
62296
62317
|
}
|
|
@@ -62573,7 +62594,7 @@ var program = async () => {
|
|
|
62573
62594
|
for (let depth = 0; depth < 6; depth += 1) {
|
|
62574
62595
|
try {
|
|
62575
62596
|
const pkg = path15.join(dir, "package.json");
|
|
62576
|
-
if (
|
|
62597
|
+
if (fsSync5.existsSync(pkg)) return dir;
|
|
62577
62598
|
} catch {
|
|
62578
62599
|
}
|
|
62579
62600
|
const parent = path15.dirname(dir);
|
|
@@ -62590,10 +62611,10 @@ var program = async () => {
|
|
|
62590
62611
|
const assetEnvPathSrc = path15.join(srcJestDir, "environment.cjs");
|
|
62591
62612
|
const assetReporterPathSrc = path15.join(srcJestDir, "reporter.cjs");
|
|
62592
62613
|
try {
|
|
62593
|
-
const haveDist =
|
|
62614
|
+
const haveDist = fsSync5.existsSync(assetReporterPathDist) && fsSync5.existsSync(assetEnvPathDist);
|
|
62594
62615
|
const useReporterSrc = haveDist ? assetReporterPathDist : assetReporterPathSrc;
|
|
62595
62616
|
const useEnvSrc = haveDist ? assetEnvPathDist : assetEnvPathSrc;
|
|
62596
|
-
if (!
|
|
62617
|
+
if (!fsSync5.existsSync(useReporterSrc) || !fsSync5.existsSync(useEnvSrc)) {
|
|
62597
62618
|
throw new Error(
|
|
62598
62619
|
`Headlamp jest assets not found. Tried:
|
|
62599
62620
|
${assetReporterPathDist}
|
|
@@ -62605,40 +62626,40 @@ Please build the package or ensure src/jest exists.`
|
|
|
62605
62626
|
}
|
|
62606
62627
|
const needsWrite = (() => {
|
|
62607
62628
|
try {
|
|
62608
|
-
const existing =
|
|
62609
|
-
const desired =
|
|
62629
|
+
const existing = fsSync5.readFileSync(reporterPath, "utf8");
|
|
62630
|
+
const desired = fsSync5.readFileSync(useReporterSrc, "utf8");
|
|
62610
62631
|
return existing !== desired;
|
|
62611
62632
|
} catch {
|
|
62612
62633
|
return true;
|
|
62613
62634
|
}
|
|
62614
62635
|
})();
|
|
62615
62636
|
if (needsWrite) {
|
|
62616
|
-
|
|
62637
|
+
fsSync5.mkdirSync(path15.dirname(reporterPath), { recursive: true });
|
|
62617
62638
|
try {
|
|
62618
|
-
|
|
62639
|
+
fsSync5.copyFileSync(useReporterSrc, reporterPath);
|
|
62619
62640
|
} catch {
|
|
62620
62641
|
}
|
|
62621
62642
|
}
|
|
62622
62643
|
try {
|
|
62623
62644
|
const outOfDate = (() => {
|
|
62624
62645
|
try {
|
|
62625
|
-
const existingEnv =
|
|
62626
|
-
const desiredEnv =
|
|
62646
|
+
const existingEnv = fsSync5.readFileSync(envPath, "utf8");
|
|
62647
|
+
const desiredEnv = fsSync5.readFileSync(useEnvSrc, "utf8");
|
|
62627
62648
|
return existingEnv !== desiredEnv;
|
|
62628
62649
|
} catch {
|
|
62629
62650
|
return true;
|
|
62630
62651
|
}
|
|
62631
62652
|
})();
|
|
62632
62653
|
if (outOfDate) {
|
|
62633
|
-
|
|
62654
|
+
fsSync5.copyFileSync(useEnvSrc, envPath);
|
|
62634
62655
|
}
|
|
62635
62656
|
} catch {
|
|
62636
62657
|
try {
|
|
62637
|
-
|
|
62658
|
+
fsSync5.mkdirSync(path15.dirname(envPath), { recursive: true });
|
|
62638
62659
|
} catch {
|
|
62639
62660
|
}
|
|
62640
62661
|
try {
|
|
62641
|
-
|
|
62662
|
+
fsSync5.copyFileSync(useEnvSrc, envPath);
|
|
62642
62663
|
} catch {
|
|
62643
62664
|
}
|
|
62644
62665
|
}
|
|
@@ -62800,10 +62821,10 @@ Please build the package or ensure src/jest exists.`
|
|
|
62800
62821
|
if (debug2) {
|
|
62801
62822
|
const capturedLen = output.length;
|
|
62802
62823
|
console.info(`jest captured output length=${capturedLen}`);
|
|
62803
|
-
const fileSizeBytes =
|
|
62824
|
+
const fileSizeBytes = fsSync5.existsSync(outJson) ? fsSync5.statSync(outJson).size : -1;
|
|
62804
62825
|
console.info(`bridge json @ ${outJson} size=${fileSizeBytes}`);
|
|
62805
62826
|
}
|
|
62806
|
-
const jsonText =
|
|
62827
|
+
const jsonText = fsSync5.readFileSync(outJson, "utf8");
|
|
62807
62828
|
const parsed = JSON.parse(jsonText);
|
|
62808
62829
|
const bridgeBase = coerceJestJsonToBridge(parsed);
|
|
62809
62830
|
const filteredForNamePattern = (() => {
|