@empiricalrun/playwright-utils 0.47.0 → 0.47.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.47.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1daa136: chore: logs for disk usage by specific locations
|
|
8
|
+
|
|
9
|
+
## 0.47.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 370c14a: chore: more logs on disk space
|
|
14
|
+
|
|
3
15
|
## 0.47.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-cleanup.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"attachment-cleanup.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,aAAa,CAA+C;IACpE,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAyC;gBAE7C,UAAU,GAAE,MAAmC;IAY3D;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;IAelD;;;OAGG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM;IASnC,OAAO,CAAC,MAAM;IA4Bd,OAAO,CAAC,cAAc;IAStB,UAAU;IAUV,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAE3C;IAED,IAAI,KAAK;;;;;;;;;MAWR;CACF"}
|
|
@@ -27,16 +27,29 @@ function formatBytes(bytes) {
|
|
|
27
27
|
}
|
|
28
28
|
function getDiskUsage() {
|
|
29
29
|
try {
|
|
30
|
-
|
|
30
|
+
return (0, child_process_1.execSync)("df -h / | tail -1", {
|
|
31
31
|
encoding: "utf8",
|
|
32
32
|
timeout: 5000,
|
|
33
33
|
}).trim();
|
|
34
|
-
return output;
|
|
35
34
|
}
|
|
36
35
|
catch {
|
|
37
36
|
return "unavailable";
|
|
38
37
|
}
|
|
39
38
|
}
|
|
39
|
+
function getDiskBreakdown() {
|
|
40
|
+
try {
|
|
41
|
+
const output = (0, child_process_1.execSync)("du -sh test-results/.playwright-artifacts-* test-results/ blob-report/ playwright-report/ /tmp/playwright-artifacts-* 2>/dev/null | sort -rh", { encoding: "utf8", timeout: 8000, cwd: "/app/source-repo" }).trim();
|
|
42
|
+
if (!output)
|
|
43
|
+
return "none";
|
|
44
|
+
const lines = output
|
|
45
|
+
.split("\n")
|
|
46
|
+
.map((l) => l.replace("test-results/", "").replace(/\t/g, " "));
|
|
47
|
+
return lines.join(", ");
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return "none";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
40
53
|
/**
|
|
41
54
|
* Tracks test attachments and evicts the oldest uploaded ones from disk
|
|
42
55
|
* when total size exceeds the configured limit.
|
|
@@ -72,6 +85,7 @@ class AttachmentCleanup {
|
|
|
72
85
|
_evictedCount = 0;
|
|
73
86
|
_evictedBytes = 0;
|
|
74
87
|
_diskLogTimer = null;
|
|
88
|
+
_diskLogTick = 0;
|
|
75
89
|
_onEvict = null;
|
|
76
90
|
constructor(limitBytes = getDefaultDiskLimitBytes()) {
|
|
77
91
|
this._limitBytes = limitBytes;
|
|
@@ -142,14 +156,16 @@ class AttachmentCleanup {
|
|
|
142
156
|
}
|
|
143
157
|
}
|
|
144
158
|
_logDiskStatus() {
|
|
145
|
-
|
|
159
|
+
this._diskLogTick++;
|
|
160
|
+
const artifactsSuffix = this._diskLogTick % 15 === 0 ? `, breakdown=${getDiskBreakdown()}` : "";
|
|
161
|
+
logger_1.logger.info(`[AttachmentCleanup] Periodic: registered=${this._registeredCount}, pending=${this._pending.size}, uploaded=${this._uploadedCount}, evicted=${this._evictedCount} (${formatBytes(this._evictedBytes)}), totalSize=${formatBytes(this._totalSize)}, limit=${formatBytes(this._limitBytes)}, disk=${getDiskUsage()}${artifactsSuffix}`);
|
|
146
162
|
}
|
|
147
163
|
logSummary() {
|
|
148
164
|
if (this._diskLogTimer) {
|
|
149
165
|
clearInterval(this._diskLogTimer);
|
|
150
166
|
this._diskLogTimer = null;
|
|
151
167
|
}
|
|
152
|
-
logger_1.logger.info(`[AttachmentCleanup] Summary: registered=${this._registeredCount}, pending=${this._pending.size}, uploaded=${this._uploadedCount}, evicted=${this._evictedCount} (${formatBytes(this._evictedBytes)}), totalSize=${formatBytes(this._totalSize)}, disk=${getDiskUsage()}`);
|
|
168
|
+
logger_1.logger.info(`[AttachmentCleanup] Summary: registered=${this._registeredCount}, pending=${this._pending.size}, uploaded=${this._uploadedCount}, evicted=${this._evictedCount} (${formatBytes(this._evictedBytes)}), totalSize=${formatBytes(this._totalSize)}, disk=${getDiskUsage()}, breakdown=${getDiskBreakdown()}`);
|
|
153
169
|
}
|
|
154
170
|
set onEvict(callback) {
|
|
155
171
|
this._onEvict = callback;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
44
44
|
"rimraf": "^6.0.1",
|
|
45
45
|
"ts-morph": "^23.0.0",
|
|
46
|
+
"@empiricalrun/cua": "^0.3.0",
|
|
46
47
|
"@empiricalrun/dashboard-client": "^0.2.0",
|
|
47
48
|
"@empiricalrun/llm": "^0.26.0",
|
|
48
49
|
"@empiricalrun/r2-uploader": "^0.9.1",
|
|
49
|
-
"@empiricalrun/cua": "^0.3.0",
|
|
50
50
|
"@empiricalrun/reporter": "^0.28.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|