@empiricalrun/playwright-utils 0.46.0 → 0.46.1

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.46.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ed258cd: feat: remove (all retries not complete and no passed) runs from blob-zip
8
+
3
9
  ## 0.46.0
4
10
 
5
11
  ### Minor Changes
@@ -20,9 +20,10 @@ declare class IncrementalBlobReporter implements Reporter {
20
20
  private _stepIdMap;
21
21
  private _uploader;
22
22
  private _flushPromise;
23
- private _lastTestEndIndex;
24
23
  private _completedTestIds;
25
24
  private _completedResultIds;
25
+ private _testRetries;
26
+ private _testResults;
26
27
  private _startTime;
27
28
  constructor();
28
29
  private _sigintHandler;
@@ -30,6 +31,7 @@ declare class IncrementalBlobReporter implements Reporter {
30
31
  private _removeSignalHandler;
31
32
  private _flushAndUpload;
32
33
  private _finalizeReportForInterrupt;
34
+ private _computeCompletedSets;
33
35
  private _removeIncompleteTestArtifacts;
34
36
  private _patchProjectSuites;
35
37
  private get _zipPath();
@@ -1 +1 @@
1
- {"version":3,"file":"incremental-blob-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/incremental-blob-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAsBnC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,cAAM,uBAAwB,YAAW,QAAQ;IAC/C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,WAAW,CAIjB;IACF,OAAO,CAAC,UAAU,CAGhB;IACF,OAAO,CAAC,WAAW,CAAS;IAC5B,OAA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,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5D,aAAa,IAAI,OAAO;CAGzB;AAID,wBAAgB,0BAA0B,IAAI,uBAAuB,GAAG,IAAI,CAE3E;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"incremental-blob-reporter.d.ts","sourceRoot":"","sources":["../../src/reporter/incremental-blob-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AAsBnC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,cAAM,uBAAwB,YAAW,QAAQ;IAC/C,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,WAAW,CAIjB;IACF,OAAO,CAAC,UAAU,CAGhB;IACF,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,iBAAiB,CAA0B;IACnD,OAAO,CAAC,mBAAmB,CAA0B;IACrD,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,YAAY,CAGN;IACd,OAAO,CAAC,UAAU,CAAsB;;IAexC,OAAO,CAAC,cAAc,CAA6B;IAEnD,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,oBAAoB;YAOd,eAAe;IAiC7B,OAAO,CAAC,2BAA2B;IAyBnC,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,8BAA8B;IAStC,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,KAAK,QAAQ,GAKnB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,aAAa,GAExB;IAED,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,aAAa;YAUP,SAAS;IAwBvB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAgB/C,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAIrD,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAuBnD,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAYrE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAY7D,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB9C;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5D,aAAa,IAAI,OAAO;CAGzB;AAID,wBAAgB,0BAA0B,IAAI,uBAAuB,GAAG,IAAI,CAE3E;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED,eAAe,uBAAuB,CAAC"}
@@ -25,9 +25,10 @@ class IncrementalBlobReporter {
25
25
  _stepIdMap = new Map(); // step -> stepId
26
26
  _uploader = null;
27
27
  _flushPromise = null;
28
- _lastTestEndIndex = -1;
29
28
  _completedTestIds = new Set();
30
29
  _completedResultIds = new Set();
30
+ _testRetries = new Map(); // testId → configured retries
31
+ _testResults = new Map(); // testId → retryIndex → {retryId, retryStatus}
31
32
  _startTime = Date.now();
32
33
  constructor() {
33
34
  if (process.env.SHARD_INDEX && process.env.TOTAL_SHARDS) {
@@ -88,12 +89,8 @@ class IncrementalBlobReporter {
88
89
  }
89
90
  }
90
91
  _finalizeReportForInterrupt() {
91
- if (this._lastTestEndIndex === -1) {
92
- console.log("[IncrementalBlobReporter] No onTestEnd found, cannot finalize report. Merge may fail");
93
- return;
94
- }
95
- // Truncate to last onTestEnd
96
- this._reportLines = this._reportLines.slice(0, this._lastTestEndIndex + 1);
92
+ // Determine which tests are fully complete (passed or all retries finished)
93
+ this._computeCompletedSets();
97
94
  // Remove unrun tests from onProject suites
98
95
  this._patchProjectSuites();
99
96
  // Remove events (onTestBegin, onStepBegin, etc.) for incomplete tests
@@ -111,7 +108,19 @@ class IncrementalBlobReporter {
111
108
  },
112
109
  };
113
110
  this._reportLines.push(JSON.stringify(onEndEvent));
114
- console.log(`[IncrementalBlobReporter] Finalized report at line ${this._lastTestEndIndex + 1}, status: interrupted`);
111
+ }
112
+ _computeCompletedSets() {
113
+ for (const [testId, results] of this._testResults) {
114
+ const configuredRetries = this._testRetries.get(testId);
115
+ const hasPassedRetry = [...results.values()].some((r) => r.status === "passed");
116
+ const allRetriesCompleted = results.size === configuredRetries + 1;
117
+ if (hasPassedRetry || allRetriesCompleted) {
118
+ this._completedTestIds.add(testId);
119
+ for (const { resultId } of results.values()) {
120
+ this._completedResultIds.add(resultId);
121
+ }
122
+ }
123
+ }
115
124
  }
116
125
  _removeIncompleteTestArtifacts() {
117
126
  this._reportLines = this._reportLines.filter((line) => {
@@ -188,11 +197,18 @@ class IncrementalBlobReporter {
188
197
  onTestEnd(test, result) {
189
198
  const events = (0, lifecycle_events_1.buildOnTestEndEvents)(test, result, this._resultIdMap, this._stagingDir);
190
199
  if (this._appendEvents(events)) {
191
- this._completedTestIds.add(test.id);
200
+ if (!this._testRetries.has(test.id)) {
201
+ this._testRetries.set(test.id, test.retries);
202
+ }
203
+ if (!this._testResults.has(test.id)) {
204
+ this._testResults.set(test.id, new Map());
205
+ }
192
206
  const resultId = this._resultIdMap.get(`${test.id}-${result.retry}`);
193
- if (resultId)
194
- this._completedResultIds.add(resultId);
195
- this._lastTestEndIndex = this._reportLines.length - 1;
207
+ if (resultId) {
208
+ this._testResults
209
+ .get(test.id)
210
+ .set(result.retry, { resultId, status: result.status });
211
+ }
196
212
  }
197
213
  }
198
214
  onStepBegin(test, result, step) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empiricalrun/playwright-utils",
3
- "version": "0.46.0",
3
+ "version": "0.46.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -43,11 +43,11 @@
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",
47
46
  "@empiricalrun/dashboard-client": "^0.2.0",
48
47
  "@empiricalrun/llm": "^0.26.0",
49
48
  "@empiricalrun/r2-uploader": "^0.9.1",
50
- "@empiricalrun/reporter": "^0.28.0"
49
+ "@empiricalrun/reporter": "^0.28.0",
50
+ "@empiricalrun/cua": "^0.3.0"
51
51
  },
52
52
  "scripts": {
53
53
  "dev": "tsc --build --watch",