headlamp 0.1.11 → 0.1.12
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 +14 -21
- package/dist/cli.cjs.map +3 -3
- package/dist/index.js +13 -20
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -736,12 +736,14 @@ __export(fast_related_exports, {
|
|
|
736
736
|
cachedRelated: () => cachedRelated,
|
|
737
737
|
findRelatedTestsFast: () => findRelatedTestsFast
|
|
738
738
|
});
|
|
739
|
-
var path2, fs, TailSegmentCount, EmptyCount, JsonIndentSpaces, DEFAULT_TEST_GLOBS, findRelatedTestsFast, cachedRelated;
|
|
739
|
+
var path2, os2, fs, import_node_crypto, TailSegmentCount, EmptyCount, JsonIndentSpaces, DEFAULT_TEST_GLOBS, findRelatedTestsFast, cachedRelated;
|
|
740
740
|
var init_fast_related = __esm({
|
|
741
741
|
"src/lib/fast-related.ts"() {
|
|
742
742
|
"use strict";
|
|
743
743
|
path2 = __toESM(require("node:path"), 1);
|
|
744
|
+
os2 = __toESM(require("node:os"), 1);
|
|
744
745
|
fs = __toESM(require("node:fs/promises"), 1);
|
|
746
|
+
import_node_crypto = require("node:crypto");
|
|
745
747
|
init_env_utils();
|
|
746
748
|
init_exec();
|
|
747
749
|
TailSegmentCount = 2;
|
|
@@ -790,9 +792,7 @@ var init_fast_related = __esm({
|
|
|
790
792
|
}
|
|
791
793
|
const args = ["-n", "-l", "-S", "-F"];
|
|
792
794
|
testGlobs.forEach((globPattern) => args.push("-g", globPattern));
|
|
793
|
-
excludeGlobs.forEach(
|
|
794
|
-
(excludeGlobPattern) => args.push("-g", `!${excludeGlobPattern}`)
|
|
795
|
-
);
|
|
795
|
+
excludeGlobs.forEach((excludeGlobPattern) => args.push("-g", `!${excludeGlobPattern}`));
|
|
796
796
|
seeds.forEach((seedToken) => args.push("-e", seedToken));
|
|
797
797
|
let raw = "";
|
|
798
798
|
try {
|
|
@@ -804,9 +804,7 @@ var init_fast_related = __esm({
|
|
|
804
804
|
}
|
|
805
805
|
const lines = raw.split(/\r?\n/).map((lineText) => lineText.trim()).filter(Boolean);
|
|
806
806
|
const looksLikeTest = (pathText) => /\.(test|spec)\.[tj]sx?$/i.test(pathText) || /(^|\/)tests?\//i.test(pathText);
|
|
807
|
-
const absolute = lines.map(
|
|
808
|
-
(relativePath) => path2.resolve(repoRoot, relativePath).replace(/\\/g, "/")
|
|
809
|
-
).filter(looksLikeTest);
|
|
807
|
+
const absolute = lines.map((relativePath) => path2.resolve(repoRoot, relativePath).replace(/\\/g, "/")).filter(looksLikeTest);
|
|
810
808
|
const uniq = Array.from(new Set(absolute));
|
|
811
809
|
const results = [];
|
|
812
810
|
await Promise.all(
|
|
@@ -821,17 +819,15 @@ var init_fast_related = __esm({
|
|
|
821
819
|
return results;
|
|
822
820
|
};
|
|
823
821
|
cachedRelated = async (opts) => {
|
|
824
|
-
const
|
|
822
|
+
const cacheRoot = process.env.HEADLAMP_CACHE_DIR || path2.join(os2.tmpdir(), "headlamp-cache");
|
|
823
|
+
const repoKey = (0, import_node_crypto.createHash)("sha1").update(path2.resolve(opts.repoRoot)).digest("hex").slice(0, 12);
|
|
824
|
+
const cacheDir = path2.join(cacheRoot, repoKey);
|
|
825
825
|
const cacheFile = path2.join(cacheDir, "relevant-tests.json");
|
|
826
826
|
let head = "nogit";
|
|
827
827
|
try {
|
|
828
|
-
const raw = await runText(
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
{
|
|
832
|
-
env: safeEnv(process.env, {})
|
|
833
|
-
}
|
|
834
|
-
);
|
|
828
|
+
const raw = await runText("git", ["-C", opts.repoRoot, "rev-parse", "--short", "HEAD"], {
|
|
829
|
+
env: safeEnv(process.env, {})
|
|
830
|
+
});
|
|
835
831
|
head = raw.trim() || "nogit";
|
|
836
832
|
} catch {
|
|
837
833
|
head = "nogit";
|
|
@@ -863,10 +859,7 @@ var init_fast_related = __esm({
|
|
|
863
859
|
try {
|
|
864
860
|
const next = { ...bag, [key]: Array.from(new Set(recomputed)) };
|
|
865
861
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
866
|
-
await fs.writeFile(
|
|
867
|
-
cacheFile,
|
|
868
|
-
JSON.stringify(next, null, JsonIndentSpaces)
|
|
869
|
-
);
|
|
862
|
+
await fs.writeFile(cacheFile, JSON.stringify(next, null, JsonIndentSpaces));
|
|
870
863
|
} catch {
|
|
871
864
|
}
|
|
872
865
|
return recomputed;
|
|
@@ -1997,7 +1990,7 @@ var require_lib = __commonJS({
|
|
|
1997
1990
|
|
|
1998
1991
|
// src/lib/program.ts
|
|
1999
1992
|
var path11 = __toESM(require("node:path"), 1);
|
|
2000
|
-
var
|
|
1993
|
+
var os3 = __toESM(require("node:os"), 1);
|
|
2001
1994
|
var fsSync3 = __toESM(require("node:fs"), 1);
|
|
2002
1995
|
var fs7 = __toESM(require("node:fs/promises"), 1);
|
|
2003
1996
|
var LibReport = __toESM(require("istanbul-lib-report"), 1);
|
|
@@ -7010,7 +7003,7 @@ var program = async () => {
|
|
|
7010
7003
|
(absTestPath) => executedTestFilesSet.add(path11.resolve(absTestPath).replace(/\\/g, "/"))
|
|
7011
7004
|
);
|
|
7012
7005
|
const outJson = path11.join(
|
|
7013
|
-
|
|
7006
|
+
os3.tmpdir(),
|
|
7014
7007
|
`jest-bridge-${Date.now()}-${Math.random().toString(36).slice(2)}.json`
|
|
7015
7008
|
);
|
|
7016
7009
|
const reporterPath = path11.resolve("scripts/jest-vitest-bridge.cjs");
|