@checksum-ai/runtime 4.18.0-beta.1 → 4.18.0-beta.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.
- package/.env +1 -1
- package/cli.js +80 -80
- package/package.json +2 -2
- package/scripts/patch.js +26 -43
- package/scripts/playwright_patches/1.62.1.js +0 -34
- package/scripts/playwright_patches/1.63.0.js +0 -600
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Checksum.ai test runtime",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@playwright/test": "1.
|
|
6
|
+
"@playwright/test": "1.62.1",
|
|
7
7
|
"dotenv": "17.4.2",
|
|
8
8
|
"jsdom": "30.0.1",
|
|
9
9
|
"playwright-extra": "4.3.6",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"url": "https://github.com/checksum-ai/checksum-ai-monorepo/issues"
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/checksum-ai/checksum-ai-monorepo/tree/main/packages/runtime#readme",
|
|
48
|
-
"version": "4.18.0-beta.
|
|
48
|
+
"version": "4.18.0-beta.2"
|
|
49
49
|
}
|
package/scripts/patch.js
CHANGED
|
@@ -6,19 +6,14 @@ function getPlaywrightPatchesDirectory() {
|
|
|
6
6
|
return join(__dirname, "playwright_patches");
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.sort();
|
|
14
|
-
}
|
|
9
|
+
const availablePatchVersions = fs
|
|
10
|
+
.readdirSync(getPlaywrightPatchesDirectory())
|
|
11
|
+
.map((patchFile) => path.basename(patchFile, ".js"))
|
|
12
|
+
.sort();
|
|
15
13
|
|
|
16
|
-
function findSuitablePatchVersion(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
) {
|
|
20
|
-
let suitablePatchVersion = available[0];
|
|
21
|
-
for (const patchVersion of available) {
|
|
14
|
+
function findSuitablePatchVersion(version) {
|
|
15
|
+
let suitablePatchVersion = availablePatchVersions[0];
|
|
16
|
+
for (const patchVersion of availablePatchVersions) {
|
|
22
17
|
if (version >= patchVersion) {
|
|
23
18
|
suitablePatchVersion = patchVersion;
|
|
24
19
|
} else {
|
|
@@ -28,38 +23,26 @@ function findSuitablePatchVersion(
|
|
|
28
23
|
return suitablePatchVersion;
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
: [".", "../", "../.."].map((project) => join(process.cwd(), project));
|
|
26
|
+
const projectRootFromEnv = process.env.PROJECT_ROOT;
|
|
27
|
+
const projectPaths = projectRootFromEnv
|
|
28
|
+
? [projectRootFromEnv]
|
|
29
|
+
: [".", "../", "../.."].map((project) => join(process.cwd(), project));
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
// Patching is best-effort: a failure here must not block the install.
|
|
31
|
+
for (const projectPath of projectPaths) {
|
|
32
|
+
try {
|
|
33
|
+
if (fs.existsSync(join(projectPath, "node_modules", "playwright"))) {
|
|
34
|
+
const absolutePathToPackageJSON = resolve(
|
|
35
|
+
join(projectPath, "node_modules", "playwright", "package.json")
|
|
36
|
+
);
|
|
37
|
+
const packageJSON = require(absolutePathToPackageJSON);
|
|
38
|
+
const playwrightVersion = packageJSON.version;
|
|
39
|
+
const patchVersion = findSuitablePatchVersion(playwrightVersion);
|
|
40
|
+
const patchPath = resolve(
|
|
41
|
+
join(getPlaywrightPatchesDirectory(), `${patchVersion}.js`)
|
|
42
|
+
);
|
|
43
|
+
require(patchPath)(projectPath);
|
|
53
44
|
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// Patching is best-effort: a failure here must not block the install.
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
|
-
|
|
57
|
-
// Guarded like playwright_pins.js: the runtime always spawns this as
|
|
58
|
-
// `node patch.js`, so requiring it must not patch anything as a side effect —
|
|
59
|
-
// that is what lets playwright_patches.spec.ts test the real selection logic
|
|
60
|
-
// instead of keeping a copy of it in sync by hand.
|
|
61
|
-
if (require.main === module) {
|
|
62
|
-
patchAll();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
module.exports = { availablePatchVersions, findSuitablePatchVersion };
|
|
@@ -525,39 +525,6 @@ function htmlReporter(projectRoot) {
|
|
|
525
525
|
replaceContent(file, originalContent, newContent);
|
|
526
526
|
}
|
|
527
527
|
|
|
528
|
-
// -------- [Shutdown safety] -------- //
|
|
529
|
-
|
|
530
|
-
// Playwright leaves two teardown fixtures at `timeout: 0`, and TimeoutManager
|
|
531
|
-
// reads that as `deadline = kMaxDeadline` — unbounded, not "use the default".
|
|
532
|
-
// Every other phase is capped at the project timeout, so these are the only two
|
|
533
|
-
// ways a worker can stop reporting for good: an unreaped browser leaves
|
|
534
|
-
// `browser.close()` awaiting a `close` event that never arrives, which is how
|
|
535
|
-
// run cc44a300 went silent for 10h42m until the k8s job deadline killed the pod.
|
|
536
|
-
// Playwright's own 5-minute worker watchdog cannot catch it — heartbeats run on
|
|
537
|
-
// an interval independent of any pending await, so a wedged worker keeps
|
|
538
|
-
// heartbeating and the deadline slides forever.
|
|
539
|
-
//
|
|
540
|
-
// `> 0 ? : ` rather than `||`: a zero, negative or unparseable override must
|
|
541
|
-
// fall back to the default, never restore the unbounded wait.
|
|
542
|
-
function boundUnboundedFixtures(projectRoot) {
|
|
543
|
-
const file = join(projectRoot, "node_modules/playwright/lib/index.js");
|
|
544
|
-
if (!doesFileExist(file)) {
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
let originalContent, newContent;
|
|
549
|
-
|
|
550
|
-
// ArtifactsRecorder.didFinishTest(): screenshot, trace stop, aria snapshot.
|
|
551
|
-
originalContent = `}, { auto: "all-hooks-included", title: "trace recording", box: true, timeout: 0 }],`;
|
|
552
|
-
newContent = `}, { auto: "all-hooks-included", title: "trace recording", box: true, timeout: Number(process.env["CHECKSUM_PW_ARTIFACTS_TIMEOUT_MS"]) > 0 ? Number(process.env["CHECKSUM_PW_ARTIFACTS_TIMEOUT_MS"]) : 120000 }],`;
|
|
553
|
-
replaceContent(file, originalContent, newContent);
|
|
554
|
-
|
|
555
|
-
// The `browser` fixture: launch on setup, `browser.close()` on teardown.
|
|
556
|
-
originalContent = `}, { scope: "worker", timeout: 0 }],`;
|
|
557
|
-
newContent = `}, { scope: "worker", timeout: Number(process.env["CHECKSUM_PW_BROWSER_FIXTURE_TIMEOUT_MS"]) > 0 ? Number(process.env["CHECKSUM_PW_BROWSER_FIXTURE_TIMEOUT_MS"]) : 180000 }],`;
|
|
558
|
-
replaceContent(file, originalContent, newContent);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
528
|
// -------- [Run] -------- //
|
|
562
529
|
|
|
563
530
|
const isRuntime = true || process.env.RUNTIME === "true";
|
|
@@ -582,7 +549,6 @@ function run(projectPath) {
|
|
|
582
549
|
reportTraceFile(projectPath);
|
|
583
550
|
}
|
|
584
551
|
htmlReporter(projectPath);
|
|
585
|
-
boundUnboundedFixtures(projectPath);
|
|
586
552
|
}
|
|
587
553
|
} else {
|
|
588
554
|
console.warn("Project path not found", projectPath);
|