headlamp 0.1.28 → 0.1.29

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/index.js CHANGED
@@ -62564,7 +62564,11 @@ var program = async () => {
62564
62564
  const cols = typeof process.stdout.columns === "number" && process.stdout.columns > 0 ? process.stdout.columns : 120;
62565
62565
  const clipped = line.length > cols ? `${line.slice(0, Math.max(0, cols - 1))}` : line;
62566
62566
  const pad = Math.max(0, cols - clipped.length - 1);
62567
- process.stdout.write(`\r${clipped}${" ".repeat(pad)}`);
62567
+ try {
62568
+ process.stdout.write(`\x1B[2K\r${clipped}${" ".repeat(pad)}`);
62569
+ } catch {
62570
+ process.stdout.write(`\r${clipped}${" ".repeat(pad)}`);
62571
+ }
62568
62572
  };
62569
62573
  renderProgress();
62570
62574
  try {
@@ -62602,7 +62606,7 @@ var program = async () => {
62602
62606
  `jest-bridge-${Date.now()}-${Math.random().toString(36).slice(2)}.json`
62603
62607
  );
62604
62608
  const reporterPath = path16.join(os4.tmpdir(), "headlamp", "reporter.cjs");
62605
- const envPath = path16.join(os4.tmpdir(), "headlamp", "environment.cjs");
62609
+ const setupPath = path16.join(os4.tmpdir(), "headlamp", "setup.cjs");
62606
62610
  const findPackageRoot = (startDir) => {
62607
62611
  let dir = path16.resolve(startDir);
62608
62612
  for (let depth = 0; depth < 6; depth += 1) {
@@ -62620,21 +62624,21 @@ var program = async () => {
62620
62624
  const packageRoot = findPackageRoot(__dirname);
62621
62625
  const distJestDir = path16.resolve(packageRoot, "dist", "jest");
62622
62626
  const srcJestDir = path16.resolve(packageRoot, "src", "jest");
62623
- const assetEnvPathDist = path16.join(distJestDir, "environment.cjs");
62627
+ const assetSetupPathDist = path16.join(distJestDir, "setup.cjs");
62624
62628
  const assetReporterPathDist = path16.join(distJestDir, "reporter.cjs");
62625
- const assetEnvPathSrc = path16.join(srcJestDir, "environment.cjs");
62629
+ const assetSetupPathSrc = path16.join(srcJestDir, "setup.cjs");
62626
62630
  const assetReporterPathSrc = path16.join(srcJestDir, "reporter.cjs");
62627
62631
  try {
62628
- const haveDist = fsSync4.existsSync(assetReporterPathDist) && fsSync4.existsSync(assetEnvPathDist);
62632
+ const haveDist = fsSync4.existsSync(assetReporterPathDist) && fsSync4.existsSync(assetSetupPathDist);
62629
62633
  const useReporterSrc = haveDist ? assetReporterPathDist : assetReporterPathSrc;
62630
- const useEnvSrc = haveDist ? assetEnvPathDist : assetEnvPathSrc;
62631
- if (!fsSync4.existsSync(useReporterSrc) || !fsSync4.existsSync(useEnvSrc)) {
62634
+ const useSetupSrc = haveDist ? assetSetupPathDist : assetSetupPathSrc;
62635
+ if (!fsSync4.existsSync(useReporterSrc) || !fsSync4.existsSync(useSetupSrc)) {
62632
62636
  throw new Error(
62633
62637
  `Headlamp jest assets not found. Tried:
62634
62638
  ${assetReporterPathDist}
62635
- ${assetEnvPathDist}
62639
+ ${assetSetupPathDist}
62636
62640
  ${assetReporterPathSrc}
62637
- ${assetEnvPathSrc}
62641
+ ${assetSetupPathSrc}
62638
62642
  Please build the package or ensure src/jest exists.`
62639
62643
  );
62640
62644
  }
@@ -62657,23 +62661,27 @@ Please build the package or ensure src/jest exists.`
62657
62661
  try {
62658
62662
  const outOfDate = (() => {
62659
62663
  try {
62660
- const existingEnv = fsSync4.readFileSync(envPath, "utf8");
62661
- const desiredEnv = fsSync4.readFileSync(useEnvSrc, "utf8");
62662
- return existingEnv !== desiredEnv;
62664
+ const existingSetup = fsSync4.readFileSync(setupPath, "utf8");
62665
+ const desiredSetup = fsSync4.readFileSync(useSetupSrc, "utf8");
62666
+ return existingSetup !== desiredSetup;
62663
62667
  } catch {
62664
62668
  return true;
62665
62669
  }
62666
62670
  })();
62667
62671
  if (outOfDate) {
62668
- fsSync4.copyFileSync(useEnvSrc, envPath);
62672
+ try {
62673
+ fsSync4.mkdirSync(path16.dirname(setupPath), { recursive: true });
62674
+ } catch {
62675
+ }
62676
+ fsSync4.copyFileSync(useSetupSrc, setupPath);
62669
62677
  }
62670
62678
  } catch {
62671
62679
  try {
62672
- fsSync4.mkdirSync(path16.dirname(envPath), { recursive: true });
62680
+ fsSync4.mkdirSync(path16.dirname(setupPath), { recursive: true });
62673
62681
  } catch {
62674
62682
  }
62675
62683
  try {
62676
- fsSync4.copyFileSync(useEnvSrc, envPath);
62684
+ fsSync4.copyFileSync(useSetupSrc, setupPath);
62677
62685
  } catch {
62678
62686
  }
62679
62687
  }
@@ -62695,8 +62703,6 @@ Please build the package or ensure src/jest exists.`
62695
62703
  `--reporters=${reporterPath}`,
62696
62704
  "--reporters=default",
62697
62705
  "--colors",
62698
- "--testEnvironment",
62699
- envPath,
62700
62706
  ...sanitizedJestRunArgs,
62701
62707
  ...collectCoverage ? [
62702
62708
  "--coverageDirectory",
@@ -62710,21 +62716,31 @@ Please build the package or ensure src/jest exists.`
62710
62716
  ];
62711
62717
  if (isDebug() || showLogs) {
62712
62718
  const hasSilentFalse = runArgs.includes("--silent=false");
62713
- const hasEnv = runArgs.includes("--testEnvironment");
62714
62719
  console.info(
62715
- `debug: showLogs=${String(showLogs)} hasSilentFalse=${String(hasSilentFalse)} hasTestEnvironment=${String(hasEnv)}`
62720
+ `debug: showLogs=${String(showLogs)} hasSilentFalse=${String(hasSilentFalse)}`
62716
62721
  );
62717
62722
  }
62718
62723
  let streamBuf = "";
62724
+ const baseEnv = safeEnv(process.env, {
62725
+ NODE_ENV: "test",
62726
+ JEST_BRIDGE_OUT: outJson,
62727
+ JEST_BRIDGE_DEBUG: showLogs ? "1" : void 0,
62728
+ JEST_BRIDGE_DEBUG_PATH: showLogs ? path16.resolve(os4.tmpdir(), `jest-bridge-debug-${Date.now()}.log`) : void 0,
62729
+ FORCE_COLOR: "3",
62730
+ TERM: process.env.TERM || "xterm-256color"
62731
+ });
62732
+ const mergedNodeOptions = (() => {
62733
+ try {
62734
+ const existing = String(process.env.NODE_OPTIONS || "").trim();
62735
+ const add = `--require ${setupPath}`;
62736
+ return `${existing ? `${existing} ` : ""}${add}`.trim();
62737
+ } catch {
62738
+ return `--require ${setupPath}`;
62739
+ }
62740
+ })();
62741
+ const envWithSetup = { ...baseEnv, NODE_OPTIONS: mergedNodeOptions };
62719
62742
  const { code, output } = await runWithStreaming(jestBin, runArgs, {
62720
- env: safeEnv(process.env, {
62721
- NODE_ENV: "test",
62722
- JEST_BRIDGE_OUT: outJson,
62723
- JEST_BRIDGE_DEBUG: showLogs ? "1" : void 0,
62724
- JEST_BRIDGE_DEBUG_PATH: showLogs ? path16.resolve(os4.tmpdir(), `jest-bridge-debug-${Date.now()}.log`) : void 0,
62725
- FORCE_COLOR: "3",
62726
- TERM: process.env.TERM || "xterm-256color"
62727
- }),
62743
+ env: envWithSetup,
62728
62744
  onChunk: (text) => {
62729
62745
  streamBuf += text;
62730
62746
  const lines = streamBuf.split(/\r?\n/);