@testver/testver 0.2.1 → 0.2.3
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 +60 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45085,7 +45085,27 @@ async function createFileWatcher(projectPath2, wss, scanner) {
|
|
|
45085
45085
|
".turbo",
|
|
45086
45086
|
".cache",
|
|
45087
45087
|
".vscode",
|
|
45088
|
-
".idea"
|
|
45088
|
+
".idea",
|
|
45089
|
+
// Test-ARTIFACT output dirs. A real automation project accumulates
|
|
45090
|
+
// thousands of generated screenshots/videos/reports here; watching them is
|
|
45091
|
+
// pointless (they're outputs, not source) and opens a file handle each,
|
|
45092
|
+
// which exhausts the OS open-file limit (EMFILE) — exactly the macOS crash
|
|
45093
|
+
// users hit on large projects. These are still served via the artifact API;
|
|
45094
|
+
// only the live-reload watcher skips them.
|
|
45095
|
+
"screenshots",
|
|
45096
|
+
"reports",
|
|
45097
|
+
"test-results",
|
|
45098
|
+
"playwright-report",
|
|
45099
|
+
"allure-results",
|
|
45100
|
+
"allure-report",
|
|
45101
|
+
"videos",
|
|
45102
|
+
"video",
|
|
45103
|
+
"traces",
|
|
45104
|
+
"har",
|
|
45105
|
+
"logs",
|
|
45106
|
+
"test-output",
|
|
45107
|
+
"reports-html",
|
|
45108
|
+
"monocart-report"
|
|
45089
45109
|
]);
|
|
45090
45110
|
const ignored = (p) => {
|
|
45091
45111
|
const rel = relative6(projectPath2, p);
|
|
@@ -45098,9 +45118,21 @@ async function createFileWatcher(projectPath2, wss, scanner) {
|
|
|
45098
45118
|
ignoreInitial: true,
|
|
45099
45119
|
awaitWriteFinish: { stabilityThreshold: 300, pollInterval: 100 }
|
|
45100
45120
|
});
|
|
45121
|
+
let watchLimitHit = false;
|
|
45101
45122
|
watcher.on("error", (err4) => {
|
|
45102
|
-
const
|
|
45103
|
-
|
|
45123
|
+
const e = err4;
|
|
45124
|
+
if ((e?.code === "EMFILE" || e?.code === "ENFILE" || e?.code === "ENOSPC") && !watchLimitHit) {
|
|
45125
|
+
watchLimitHit = true;
|
|
45126
|
+
console.warn(
|
|
45127
|
+
`[testver] Live file-watching disabled \u2014 the OS open-file limit was reached (${e.code}). The dashboard works normally; only auto-refresh-on-file-change is off. To re-enable it, raise the limit before launching (e.g. "ulimit -n 10240" then "testver serve") or run from a directory with fewer generated files.`
|
|
45128
|
+
);
|
|
45129
|
+
watcher.close().catch(() => {
|
|
45130
|
+
});
|
|
45131
|
+
return;
|
|
45132
|
+
}
|
|
45133
|
+
if (!watchLimitHit) {
|
|
45134
|
+
console.warn(`[testver] file watcher error (non-fatal, continuing): ${e?.message || err4}`);
|
|
45135
|
+
}
|
|
45104
45136
|
});
|
|
45105
45137
|
let rescanTimer = null;
|
|
45106
45138
|
const scheduleRescan = () => {
|
|
@@ -68539,7 +68571,7 @@ function mountResultsRoutes(app, resultsStore3, artifactFetcher) {
|
|
|
68539
68571
|
try {
|
|
68540
68572
|
const { scanAllTests: scanAllTests2 } = await Promise.resolve().then(() => (init_test_scanner(), test_scanner_exports));
|
|
68541
68573
|
const { generateHumanSteps: generateHumanSteps2 } = await Promise.resolve().then(() => (init_step_generator(), step_generator_exports));
|
|
68542
|
-
const { readFileSync:
|
|
68574
|
+
const { readFileSync: readFileSync49, existsSync: existsSync69 } = await import("fs");
|
|
68543
68575
|
const { resolve: resolve19, basename: basename14 } = await import("path");
|
|
68544
68576
|
const scanResult = scanAllTests2(run2.projectPath);
|
|
68545
68577
|
const allScannedTests = scanResult.suites.flatMap((s) => s.tests);
|
|
@@ -68553,7 +68585,7 @@ function mountResultsRoutes(app, resultsStore3, artifactFetcher) {
|
|
|
68553
68585
|
if (matchedTest?.line) {
|
|
68554
68586
|
const fullPath = resolve19(run2.projectPath, matchedTest.file);
|
|
68555
68587
|
if (existsSync69(fullPath)) {
|
|
68556
|
-
const content =
|
|
68588
|
+
const content = readFileSync49(fullPath, "utf-8");
|
|
68557
68589
|
const allLines = content.split("\n");
|
|
68558
68590
|
const endLine = Math.min(matchedTest.endLine || matchedTest.line + 50, allLines.length);
|
|
68559
68591
|
const source = allLines.slice(matchedTest.line - 1, endLine).join("\n");
|
|
@@ -74510,11 +74542,11 @@ function mountRecorderRoutes(app, wss, options) {
|
|
|
74510
74542
|
let mergeContext;
|
|
74511
74543
|
if (mergeMode && targetTestFile) {
|
|
74512
74544
|
try {
|
|
74513
|
-
const { readFileSync:
|
|
74545
|
+
const { readFileSync: readFileSync49, existsSync: existsSync69 } = await import("fs");
|
|
74514
74546
|
const { resolve: resolve19 } = await import("path");
|
|
74515
74547
|
const fullPath = resolve19(projectPath2, targetTestFile);
|
|
74516
74548
|
if (existsSync69(fullPath)) {
|
|
74517
|
-
const targetContent =
|
|
74549
|
+
const targetContent = readFileSync49(fullPath, "utf-8");
|
|
74518
74550
|
mergeContext = {
|
|
74519
74551
|
targetFile: targetTestFile,
|
|
74520
74552
|
targetContent,
|
|
@@ -88757,7 +88789,7 @@ function mountTestManagementRoutes(app, tmStore4, projectPath2) {
|
|
|
88757
88789
|
});
|
|
88758
88790
|
app.post("/api/tm/mappings/check-sync", async (_req, res) => {
|
|
88759
88791
|
try {
|
|
88760
|
-
const { existsSync: existsSync69, readFileSync:
|
|
88792
|
+
const { existsSync: existsSync69, readFileSync: readFileSync49 } = await import("fs");
|
|
88761
88793
|
const { createHash: createHash4 } = await import("crypto");
|
|
88762
88794
|
const mappings = tmStore4.listScriptMappings();
|
|
88763
88795
|
let syncedCount = 0;
|
|
@@ -88770,7 +88802,7 @@ function mountTestManagementRoutes(app, tmStore4, projectPath2) {
|
|
|
88770
88802
|
missingCount++;
|
|
88771
88803
|
continue;
|
|
88772
88804
|
}
|
|
88773
|
-
const content =
|
|
88805
|
+
const content = readFileSync49(fullPath, "utf-8");
|
|
88774
88806
|
const currentHash = createHash4("md5").update(content).digest("hex");
|
|
88775
88807
|
if (m.scriptHash && m.scriptHash !== currentHash) {
|
|
88776
88808
|
tmStore4.updateMappingSyncStatus(m.testCaseId, "script_updated", currentHash);
|
|
@@ -96999,12 +97031,20 @@ ${JSON.stringify(saved.spec.cells, null, 2).slice(0, 6e3)}
|
|
|
96999
97031
|
res.status(500).json({ error: String(error) });
|
|
97000
97032
|
}
|
|
97001
97033
|
});
|
|
97034
|
+
function getServerPackageVersion() {
|
|
97035
|
+
try {
|
|
97036
|
+
const dir = dirname9(fileURLToPath2(import.meta.url));
|
|
97037
|
+
return JSON.parse(readFileSync47(join67(dir, "..", "package.json"), "utf-8")).version || "0.0.0";
|
|
97038
|
+
} catch {
|
|
97039
|
+
return "0.0.0";
|
|
97040
|
+
}
|
|
97041
|
+
}
|
|
97002
97042
|
app.get("/api/health", (_req, res) => {
|
|
97003
97043
|
const uptime = process.uptime();
|
|
97004
97044
|
const memUsage = process.memoryUsage();
|
|
97005
97045
|
res.json({
|
|
97006
97046
|
status: "healthy",
|
|
97007
|
-
version:
|
|
97047
|
+
version: getServerPackageVersion(),
|
|
97008
97048
|
uptime: Math.round(uptime),
|
|
97009
97049
|
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`,
|
|
97010
97050
|
memory: {
|
|
@@ -97889,6 +97929,7 @@ URL: ${url}
|
|
|
97889
97929
|
// src/index.ts
|
|
97890
97930
|
import { configDotenv } from "dotenv";
|
|
97891
97931
|
import { resolve as resolve18 } from "path";
|
|
97932
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
97892
97933
|
|
|
97893
97934
|
// src/repl/repl.ts
|
|
97894
97935
|
init_orchestrator();
|
|
@@ -99461,8 +99502,16 @@ configDotenv({ path: resolve18(process.cwd(), ".env"), quiet: true });
|
|
|
99461
99502
|
configDotenv({ path: resolve18(import.meta.dirname || ".", "..", ".env"), quiet: true });
|
|
99462
99503
|
var args = process.argv.slice(2);
|
|
99463
99504
|
var workingDirectory = process.cwd();
|
|
99505
|
+
function getPackageVersion() {
|
|
99506
|
+
try {
|
|
99507
|
+
const pkgPath = resolve18(import.meta.dirname || ".", "..", "package.json");
|
|
99508
|
+
return JSON.parse(readFileSync48(pkgPath, "utf-8")).version || "0.0.0";
|
|
99509
|
+
} catch {
|
|
99510
|
+
return "0.0.0";
|
|
99511
|
+
}
|
|
99512
|
+
}
|
|
99464
99513
|
if (args.includes("--version") || args.includes("-v")) {
|
|
99465
|
-
console.log(
|
|
99514
|
+
console.log(`testver v${getPackageVersion()}`);
|
|
99466
99515
|
process.exit(0);
|
|
99467
99516
|
}
|
|
99468
99517
|
if (args.includes("--help") || args.includes("-h")) {
|