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/cli.cjs CHANGED
@@ -60995,7 +60995,11 @@ var program = async () => {
60995
60995
  const cols = typeof process.stdout.columns === "number" && process.stdout.columns > 0 ? process.stdout.columns : 120;
60996
60996
  const clipped = line.length > cols ? `${line.slice(0, Math.max(0, cols - 1))}` : line;
60997
60997
  const pad = Math.max(0, cols - clipped.length - 1);
60998
- process.stdout.write(`\r${clipped}${" ".repeat(pad)}`);
60998
+ try {
60999
+ process.stdout.write(`\x1B[2K\r${clipped}${" ".repeat(pad)}`);
61000
+ } catch {
61001
+ process.stdout.write(`\r${clipped}${" ".repeat(pad)}`);
61002
+ }
60999
61003
  };
61000
61004
  renderProgress();
61001
61005
  try {
@@ -61033,7 +61037,7 @@ var program = async () => {
61033
61037
  `jest-bridge-${Date.now()}-${Math.random().toString(36).slice(2)}.json`
61034
61038
  );
61035
61039
  const reporterPath = path16.join(os4.tmpdir(), "headlamp", "reporter.cjs");
61036
- const envPath = path16.join(os4.tmpdir(), "headlamp", "environment.cjs");
61040
+ const setupPath = path16.join(os4.tmpdir(), "headlamp", "setup.cjs");
61037
61041
  const findPackageRoot = (startDir) => {
61038
61042
  let dir = path16.resolve(startDir);
61039
61043
  for (let depth = 0; depth < 6; depth += 1) {
@@ -61051,21 +61055,21 @@ var program = async () => {
61051
61055
  const packageRoot = findPackageRoot(__dirname);
61052
61056
  const distJestDir = path16.resolve(packageRoot, "dist", "jest");
61053
61057
  const srcJestDir = path16.resolve(packageRoot, "src", "jest");
61054
- const assetEnvPathDist = path16.join(distJestDir, "environment.cjs");
61058
+ const assetSetupPathDist = path16.join(distJestDir, "setup.cjs");
61055
61059
  const assetReporterPathDist = path16.join(distJestDir, "reporter.cjs");
61056
- const assetEnvPathSrc = path16.join(srcJestDir, "environment.cjs");
61060
+ const assetSetupPathSrc = path16.join(srcJestDir, "setup.cjs");
61057
61061
  const assetReporterPathSrc = path16.join(srcJestDir, "reporter.cjs");
61058
61062
  try {
61059
- const haveDist = fsSync4.existsSync(assetReporterPathDist) && fsSync4.existsSync(assetEnvPathDist);
61063
+ const haveDist = fsSync4.existsSync(assetReporterPathDist) && fsSync4.existsSync(assetSetupPathDist);
61060
61064
  const useReporterSrc = haveDist ? assetReporterPathDist : assetReporterPathSrc;
61061
- const useEnvSrc = haveDist ? assetEnvPathDist : assetEnvPathSrc;
61062
- if (!fsSync4.existsSync(useReporterSrc) || !fsSync4.existsSync(useEnvSrc)) {
61065
+ const useSetupSrc = haveDist ? assetSetupPathDist : assetSetupPathSrc;
61066
+ if (!fsSync4.existsSync(useReporterSrc) || !fsSync4.existsSync(useSetupSrc)) {
61063
61067
  throw new Error(
61064
61068
  `Headlamp jest assets not found. Tried:
61065
61069
  ${assetReporterPathDist}
61066
- ${assetEnvPathDist}
61070
+ ${assetSetupPathDist}
61067
61071
  ${assetReporterPathSrc}
61068
- ${assetEnvPathSrc}
61072
+ ${assetSetupPathSrc}
61069
61073
  Please build the package or ensure src/jest exists.`
61070
61074
  );
61071
61075
  }
@@ -61088,23 +61092,27 @@ Please build the package or ensure src/jest exists.`
61088
61092
  try {
61089
61093
  const outOfDate = (() => {
61090
61094
  try {
61091
- const existingEnv = fsSync4.readFileSync(envPath, "utf8");
61092
- const desiredEnv = fsSync4.readFileSync(useEnvSrc, "utf8");
61093
- return existingEnv !== desiredEnv;
61095
+ const existingSetup = fsSync4.readFileSync(setupPath, "utf8");
61096
+ const desiredSetup = fsSync4.readFileSync(useSetupSrc, "utf8");
61097
+ return existingSetup !== desiredSetup;
61094
61098
  } catch {
61095
61099
  return true;
61096
61100
  }
61097
61101
  })();
61098
61102
  if (outOfDate) {
61099
- fsSync4.copyFileSync(useEnvSrc, envPath);
61103
+ try {
61104
+ fsSync4.mkdirSync(path16.dirname(setupPath), { recursive: true });
61105
+ } catch {
61106
+ }
61107
+ fsSync4.copyFileSync(useSetupSrc, setupPath);
61100
61108
  }
61101
61109
  } catch {
61102
61110
  try {
61103
- fsSync4.mkdirSync(path16.dirname(envPath), { recursive: true });
61111
+ fsSync4.mkdirSync(path16.dirname(setupPath), { recursive: true });
61104
61112
  } catch {
61105
61113
  }
61106
61114
  try {
61107
- fsSync4.copyFileSync(useEnvSrc, envPath);
61115
+ fsSync4.copyFileSync(useSetupSrc, setupPath);
61108
61116
  } catch {
61109
61117
  }
61110
61118
  }
@@ -61126,8 +61134,6 @@ Please build the package or ensure src/jest exists.`
61126
61134
  `--reporters=${reporterPath}`,
61127
61135
  "--reporters=default",
61128
61136
  "--colors",
61129
- "--testEnvironment",
61130
- envPath,
61131
61137
  ...sanitizedJestRunArgs,
61132
61138
  ...collectCoverage ? [
61133
61139
  "--coverageDirectory",
@@ -61141,21 +61147,31 @@ Please build the package or ensure src/jest exists.`
61141
61147
  ];
61142
61148
  if (isDebug() || showLogs) {
61143
61149
  const hasSilentFalse = runArgs.includes("--silent=false");
61144
- const hasEnv = runArgs.includes("--testEnvironment");
61145
61150
  console.info(
61146
- `debug: showLogs=${String(showLogs)} hasSilentFalse=${String(hasSilentFalse)} hasTestEnvironment=${String(hasEnv)}`
61151
+ `debug: showLogs=${String(showLogs)} hasSilentFalse=${String(hasSilentFalse)}`
61147
61152
  );
61148
61153
  }
61149
61154
  let streamBuf = "";
61155
+ const baseEnv = safeEnv(process.env, {
61156
+ NODE_ENV: "test",
61157
+ JEST_BRIDGE_OUT: outJson,
61158
+ JEST_BRIDGE_DEBUG: showLogs ? "1" : void 0,
61159
+ JEST_BRIDGE_DEBUG_PATH: showLogs ? path16.resolve(os4.tmpdir(), `jest-bridge-debug-${Date.now()}.log`) : void 0,
61160
+ FORCE_COLOR: "3",
61161
+ TERM: process.env.TERM || "xterm-256color"
61162
+ });
61163
+ const mergedNodeOptions = (() => {
61164
+ try {
61165
+ const existing = String(process.env.NODE_OPTIONS || "").trim();
61166
+ const add = `--require ${setupPath}`;
61167
+ return `${existing ? `${existing} ` : ""}${add}`.trim();
61168
+ } catch {
61169
+ return `--require ${setupPath}`;
61170
+ }
61171
+ })();
61172
+ const envWithSetup = { ...baseEnv, NODE_OPTIONS: mergedNodeOptions };
61150
61173
  const { code, output } = await runWithStreaming(jestBin, runArgs, {
61151
- env: safeEnv(process.env, {
61152
- NODE_ENV: "test",
61153
- JEST_BRIDGE_OUT: outJson,
61154
- JEST_BRIDGE_DEBUG: showLogs ? "1" : void 0,
61155
- JEST_BRIDGE_DEBUG_PATH: showLogs ? path16.resolve(os4.tmpdir(), `jest-bridge-debug-${Date.now()}.log`) : void 0,
61156
- FORCE_COLOR: "3",
61157
- TERM: process.env.TERM || "xterm-256color"
61158
- }),
61174
+ env: envWithSetup,
61159
61175
  onChunk: (text) => {
61160
61176
  streamBuf += text;
61161
61177
  const lines = streamBuf.split(/\r?\n/);