@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,5 +1,11 @@
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
+
3
9
  ## 0.47.1
4
10
 
5
11
  ### Patch Changes
@@ -33,6 +33,7 @@ export declare class AttachmentCleanup {
33
33
  private _evictedCount;
34
34
  private _evictedBytes;
35
35
  private _diskLogTimer;
36
+ private _diskLogTick;
36
37
  private _onEvict;
37
38
  constructor(limitBytes?: number);
38
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-cleanup.d.ts","sourceRoot":"","sources":["../../src/reporter/attachment-cleanup.ts"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;;;;;;;;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,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;IAMtB,UAAU;IAUV,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAE3C;IAED,IAAI,KAAK;;;;;;;;;MAWR;CACF"}
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 getTracingDirCount() {
39
+ function getDiskBreakdown() {
40
40
  try {
41
- const output = (0, child_process_1.execSync)("ls -d /tmp/playwright-tracing-* 2>/dev/null | wc -l", { encoding: "utf8", timeout: 3000 }).trim();
42
- return parseInt(output, 10) || 0;
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 0;
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
- 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()}, tracingDirs=${getTracingDirCount()}`);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.47.1",
3
+ "version": "0.47.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"