@empiricalrun/playwright-utils 0.46.0 → 0.46.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.46.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 364eb85: fix: skipped tests have 1 retry. persist them
8
+
9
+ ## 0.46.1
10
+
11
+ ### Patch Changes
12
+
13
+ - ed258cd: feat: remove (all retries not complete and no passed) runs from blob-zip
14
+
3
15
  ## 0.46.0
4
16
 
5
17
  ### 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,W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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"}
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;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Ids = new Set();
30
29
  _completedResultIds = new Set();
30
+ _testRetries = new Map(); // testId → configured retries
31
+ _testResults = new Map(); // testId → retryIndex → {resultId, status, expectedStatus}
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,31 @@ 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
+ // Logic mirrors isDataForAllRetriesReceived in apps/dashboard/src/lib/test-diagnosis/utils.ts
113
+ _computeCompletedSets() {
114
+ for (const [testId, results] of this._testResults) {
115
+ let maxRetries = this._testRetries.get(testId);
116
+ for (const [retryIndex, r] of results) {
117
+ if (r.status === r.expectedStatus) {
118
+ maxRetries = retryIndex;
119
+ break;
120
+ }
121
+ }
122
+ let isComplete = true;
123
+ for (let retryIndex = 0; retryIndex <= maxRetries; retryIndex++) {
124
+ if (!results.has(retryIndex)) {
125
+ isComplete = false;
126
+ break;
127
+ }
128
+ }
129
+ if (isComplete) {
130
+ this._completedTestIds.add(testId);
131
+ for (const { resultId } of results.values()) {
132
+ this._completedResultIds.add(resultId);
133
+ }
134
+ }
135
+ }
115
136
  }
116
137
  _removeIncompleteTestArtifacts() {
117
138
  this._reportLines = this._reportLines.filter((line) => {
@@ -188,11 +209,20 @@ class IncrementalBlobReporter {
188
209
  onTestEnd(test, result) {
189
210
  const events = (0, lifecycle_events_1.buildOnTestEndEvents)(test, result, this._resultIdMap, this._stagingDir);
190
211
  if (this._appendEvents(events)) {
191
- this._completedTestIds.add(test.id);
212
+ if (!this._testRetries.has(test.id)) {
213
+ this._testRetries.set(test.id, test.retries);
214
+ }
215
+ if (!this._testResults.has(test.id)) {
216
+ this._testResults.set(test.id, new Map());
217
+ }
192
218
  const resultId = this._resultIdMap.get(`${test.id}-${result.retry}`);
193
- if (resultId)
194
- this._completedResultIds.add(resultId);
195
- this._lastTestEndIndex = this._reportLines.length - 1;
219
+ if (resultId) {
220
+ this._testResults.get(test.id).set(result.retry, {
221
+ resultId,
222
+ status: result.status,
223
+ expectedStatus: test.expectedStatus,
224
+ });
225
+ }
196
226
  }
197
227
  }
198
228
  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.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"