@testdino/playwright 1.0.2 → 1.0.3
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/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -391,7 +391,7 @@ var EventBuffer = class {
|
|
|
391
391
|
events = [];
|
|
392
392
|
maxSize;
|
|
393
393
|
onFlush;
|
|
394
|
-
|
|
394
|
+
flushPromise = null;
|
|
395
395
|
constructor(options) {
|
|
396
396
|
this.maxSize = options.maxSize || 10;
|
|
397
397
|
this.onFlush = options.onFlush || (async () => {
|
|
@@ -409,12 +409,30 @@ var EventBuffer = class {
|
|
|
409
409
|
}
|
|
410
410
|
/**
|
|
411
411
|
* Flush all buffered events
|
|
412
|
+
* If a flush is already in progress, waits for it to complete then flushes any new events
|
|
412
413
|
*/
|
|
413
414
|
async flush() {
|
|
414
|
-
if (this.
|
|
415
|
+
if (this.flushPromise) {
|
|
416
|
+
await this.flushPromise;
|
|
417
|
+
if (this.events.length > 0) {
|
|
418
|
+
return this.flush();
|
|
419
|
+
}
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (this.events.length === 0) {
|
|
415
423
|
return;
|
|
416
424
|
}
|
|
417
|
-
this.
|
|
425
|
+
this.flushPromise = this.doFlush();
|
|
426
|
+
try {
|
|
427
|
+
await this.flushPromise;
|
|
428
|
+
} finally {
|
|
429
|
+
this.flushPromise = null;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Internal flush implementation
|
|
434
|
+
*/
|
|
435
|
+
async doFlush() {
|
|
418
436
|
try {
|
|
419
437
|
const eventsToFlush = [...this.events];
|
|
420
438
|
this.events = [];
|
|
@@ -422,8 +440,6 @@ var EventBuffer = class {
|
|
|
422
440
|
} catch (error) {
|
|
423
441
|
console.error("Failed to flush events:", error);
|
|
424
442
|
throw error;
|
|
425
|
-
} finally {
|
|
426
|
-
this.isFlushing = false;
|
|
427
443
|
}
|
|
428
444
|
}
|
|
429
445
|
/**
|
|
@@ -2090,6 +2106,9 @@ var TestdinoReporter = class {
|
|
|
2090
2106
|
*/
|
|
2091
2107
|
async onEnd(result) {
|
|
2092
2108
|
if (this.quotaExceeded) {
|
|
2109
|
+
if (this.pendingTestEndPromises.size > 0) {
|
|
2110
|
+
await Promise.allSettled(Array.from(this.pendingTestEndPromises));
|
|
2111
|
+
}
|
|
2093
2112
|
console.log("\u2705 TestDino: Tests completed (quota limit reached; not streamed to TestDino)");
|
|
2094
2113
|
this.wsClient?.close();
|
|
2095
2114
|
this.removeSignalHandlers();
|
|
@@ -2579,7 +2598,7 @@ var TestdinoReporter = class {
|
|
|
2579
2598
|
try {
|
|
2580
2599
|
await Promise.race([
|
|
2581
2600
|
Promise.allSettled(Array.from(this.pendingTestEndPromises)),
|
|
2582
|
-
this.timeoutPromise(
|
|
2601
|
+
this.timeoutPromise(2e3, "Pending events timeout")
|
|
2583
2602
|
]);
|
|
2584
2603
|
} catch {
|
|
2585
2604
|
}
|