@testver/testver 0.2.0 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -31
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45064,34 +45064,44 @@ var init_project_scanner = __esm({
45064
45064
  import { relative as relative6 } from "path";
45065
45065
  async function createFileWatcher(projectPath2, wss, scanner) {
45066
45066
  const { watch: watch2 } = await import("chokidar");
45067
+ const IGNORED_DIRS = /* @__PURE__ */ new Set([
45068
+ "node_modules",
45069
+ "dist",
45070
+ "build",
45071
+ ".git",
45072
+ "coverage",
45073
+ "__pycache__",
45074
+ "target",
45075
+ ".next",
45076
+ ".nuxt",
45077
+ "out",
45078
+ ".tox",
45079
+ ".mypy_cache",
45080
+ // Internal/tooling dirs — noise in the Recent Activity feed and rescans.
45081
+ // `.testver/` is where we write activity.json itself, so not ignoring it
45082
+ // would cause a self-triggering loop.
45083
+ ".testver",
45084
+ ".pytest_cache",
45085
+ ".turbo",
45086
+ ".cache",
45087
+ ".vscode",
45088
+ ".idea"
45089
+ ]);
45090
+ const ignored = (p) => {
45091
+ const rel = relative6(projectPath2, p);
45092
+ if (!rel || rel.startsWith("..")) return false;
45093
+ return rel.split(/[\\/]/).some((seg) => IGNORED_DIRS.has(seg));
45094
+ };
45067
45095
  const watcher = watch2(projectPath2, {
45068
- ignored: [
45069
- "**/node_modules/**",
45070
- "**/dist/**",
45071
- "**/build/**",
45072
- "**/.git/**",
45073
- "**/coverage/**",
45074
- "**/__pycache__/**",
45075
- "**/target/**",
45076
- "**/.next/**",
45077
- "**/.nuxt/**",
45078
- "**/out/**",
45079
- "**/.tox/**",
45080
- "**/.mypy_cache/**",
45081
- // Internal/tooling dirs — noise in the Recent Activity feed and
45082
- // rescans. `.testver/` is where we write activity.json itself, so
45083
- // not ignoring it would cause a self-triggering loop.
45084
- "**/.testver/**",
45085
- "**/.pytest_cache/**",
45086
- "**/.turbo/**",
45087
- "**/.cache/**",
45088
- "**/.vscode/**",
45089
- "**/.idea/**"
45090
- ],
45096
+ ignored,
45091
45097
  persistent: true,
45092
45098
  ignoreInitial: true,
45093
45099
  awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }
45094
45100
  });
45101
+ watcher.on("error", (err4) => {
45102
+ const msg = err4?.message || String(err4);
45103
+ console.warn(`[testver] file watcher error (non-fatal, continuing): ${msg}`);
45104
+ });
45095
45105
  let rescanTimer = null;
45096
45106
  const scheduleRescan = () => {
45097
45107
  if (rescanTimer) clearTimeout(rescanTimer);
@@ -68529,7 +68539,7 @@ function mountResultsRoutes(app, resultsStore3, artifactFetcher) {
68529
68539
  try {
68530
68540
  const { scanAllTests: scanAllTests2 } = await Promise.resolve().then(() => (init_test_scanner(), test_scanner_exports));
68531
68541
  const { generateHumanSteps: generateHumanSteps2 } = await Promise.resolve().then(() => (init_step_generator(), step_generator_exports));
68532
- const { readFileSync: readFileSync48, existsSync: existsSync69 } = await import("fs");
68542
+ const { readFileSync: readFileSync49, existsSync: existsSync69 } = await import("fs");
68533
68543
  const { resolve: resolve19, basename: basename14 } = await import("path");
68534
68544
  const scanResult = scanAllTests2(run2.projectPath);
68535
68545
  const allScannedTests = scanResult.suites.flatMap((s) => s.tests);
@@ -68543,7 +68553,7 @@ function mountResultsRoutes(app, resultsStore3, artifactFetcher) {
68543
68553
  if (matchedTest?.line) {
68544
68554
  const fullPath = resolve19(run2.projectPath, matchedTest.file);
68545
68555
  if (existsSync69(fullPath)) {
68546
- const content = readFileSync48(fullPath, "utf-8");
68556
+ const content = readFileSync49(fullPath, "utf-8");
68547
68557
  const allLines = content.split("\n");
68548
68558
  const endLine = Math.min(matchedTest.endLine || matchedTest.line + 50, allLines.length);
68549
68559
  const source = allLines.slice(matchedTest.line - 1, endLine).join("\n");
@@ -74500,11 +74510,11 @@ function mountRecorderRoutes(app, wss, options) {
74500
74510
  let mergeContext;
74501
74511
  if (mergeMode && targetTestFile) {
74502
74512
  try {
74503
- const { readFileSync: readFileSync48, existsSync: existsSync69 } = await import("fs");
74513
+ const { readFileSync: readFileSync49, existsSync: existsSync69 } = await import("fs");
74504
74514
  const { resolve: resolve19 } = await import("path");
74505
74515
  const fullPath = resolve19(projectPath2, targetTestFile);
74506
74516
  if (existsSync69(fullPath)) {
74507
- const targetContent = readFileSync48(fullPath, "utf-8");
74517
+ const targetContent = readFileSync49(fullPath, "utf-8");
74508
74518
  mergeContext = {
74509
74519
  targetFile: targetTestFile,
74510
74520
  targetContent,
@@ -88747,7 +88757,7 @@ function mountTestManagementRoutes(app, tmStore4, projectPath2) {
88747
88757
  });
88748
88758
  app.post("/api/tm/mappings/check-sync", async (_req, res) => {
88749
88759
  try {
88750
- const { existsSync: existsSync69, readFileSync: readFileSync48 } = await import("fs");
88760
+ const { existsSync: existsSync69, readFileSync: readFileSync49 } = await import("fs");
88751
88761
  const { createHash: createHash4 } = await import("crypto");
88752
88762
  const mappings = tmStore4.listScriptMappings();
88753
88763
  let syncedCount = 0;
@@ -88760,7 +88770,7 @@ function mountTestManagementRoutes(app, tmStore4, projectPath2) {
88760
88770
  missingCount++;
88761
88771
  continue;
88762
88772
  }
88763
- const content = readFileSync48(fullPath, "utf-8");
88773
+ const content = readFileSync49(fullPath, "utf-8");
88764
88774
  const currentHash = createHash4("md5").update(content).digest("hex");
88765
88775
  if (m.scriptHash && m.scriptHash !== currentHash) {
88766
88776
  tmStore4.updateMappingSyncStatus(m.testCaseId, "script_updated", currentHash);
@@ -96989,12 +96999,20 @@ ${JSON.stringify(saved.spec.cells, null, 2).slice(0, 6e3)}
96989
96999
  res.status(500).json({ error: String(error) });
96990
97000
  }
96991
97001
  });
97002
+ function getServerPackageVersion() {
97003
+ try {
97004
+ const dir = dirname9(fileURLToPath2(import.meta.url));
97005
+ return JSON.parse(readFileSync47(join67(dir, "..", "package.json"), "utf-8")).version || "0.0.0";
97006
+ } catch {
97007
+ return "0.0.0";
97008
+ }
97009
+ }
96992
97010
  app.get("/api/health", (_req, res) => {
96993
97011
  const uptime = process.uptime();
96994
97012
  const memUsage = process.memoryUsage();
96995
97013
  res.json({
96996
97014
  status: "healthy",
96997
- version: process.env.npm_package_version || "0.1.0",
97015
+ version: getServerPackageVersion(),
96998
97016
  uptime: Math.round(uptime),
96999
97017
  uptimeHuman: uptime > 86400 ? `${Math.floor(uptime / 86400)}d ${Math.floor(uptime % 86400 / 3600)}h` : uptime > 3600 ? `${Math.floor(uptime / 3600)}h ${Math.floor(uptime % 3600 / 60)}m` : `${Math.floor(uptime / 60)}m ${Math.round(uptime % 60)}s`,
97000
97018
  memory: {
@@ -97879,6 +97897,7 @@ URL: ${url}
97879
97897
  // src/index.ts
97880
97898
  import { configDotenv } from "dotenv";
97881
97899
  import { resolve as resolve18 } from "path";
97900
+ import { readFileSync as readFileSync48 } from "fs";
97882
97901
 
97883
97902
  // src/repl/repl.ts
97884
97903
  init_orchestrator();
@@ -99451,8 +99470,16 @@ configDotenv({ path: resolve18(process.cwd(), ".env"), quiet: true });
99451
99470
  configDotenv({ path: resolve18(import.meta.dirname || ".", "..", ".env"), quiet: true });
99452
99471
  var args = process.argv.slice(2);
99453
99472
  var workingDirectory = process.cwd();
99473
+ function getPackageVersion() {
99474
+ try {
99475
+ const pkgPath = resolve18(import.meta.dirname || ".", "..", "package.json");
99476
+ return JSON.parse(readFileSync48(pkgPath, "utf-8")).version || "0.0.0";
99477
+ } catch {
99478
+ return "0.0.0";
99479
+ }
99480
+ }
99454
99481
  if (args.includes("--version") || args.includes("-v")) {
99455
- console.log("testver v0.1.0");
99482
+ console.log(`testver v${getPackageVersion()}`);
99456
99483
  process.exit(0);
99457
99484
  }
99458
99485
  if (args.includes("--help") || args.includes("-h")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testver/testver",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AI-powered interactive CLI for test automation",
5
5
  "type": "module",
6
6
  "publishConfig": {