@empiricalrun/playwright-utils 0.47.1 → 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 +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"}
|
|
@@ -36,13 +36,18 @@ function getDiskUsage() {
|
|
|
36
36
|
return "unavailable";
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function getDiskBreakdown() {
|
|
40
40
|
try {
|
|
41
|
-
const output = (0, child_process_1.execSync)("
|
|
42
|
-
|
|
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(", ");
|
|
43
48
|
}
|
|
44
49
|
catch {
|
|
45
|
-
return
|
|
50
|
+
return "none";
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
@@ -80,6 +85,7 @@ class AttachmentCleanup {
|
|
|
80
85
|
_evictedCount = 0;
|
|
81
86
|
_evictedBytes = 0;
|
|
82
87
|
_diskLogTimer = null;
|
|
88
|
+
_diskLogTick = 0;
|
|
83
89
|
_onEvict = null;
|
|
84
90
|
constructor(limitBytes = getDefaultDiskLimitBytes()) {
|
|
85
91
|
this._limitBytes = limitBytes;
|
|
@@ -150,14 +156,16 @@ class AttachmentCleanup {
|
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
158
|
_logDiskStatus() {
|
|
153
|
-
|
|
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}`);
|
|
154
162
|
}
|
|
155
163
|
logSummary() {
|
|
156
164
|
if (this._diskLogTimer) {
|
|
157
165
|
clearInterval(this._diskLogTimer);
|
|
158
166
|
this._diskLogTimer = null;
|
|
159
167
|
}
|
|
160
|
-
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()}`);
|
|
161
169
|
}
|
|
162
170
|
set onEvict(callback) {
|
|
163
171
|
this._onEvict = callback;
|