@testdino/playwright 1.0.2 → 1.0.4
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/cli/index.js +3 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +3 -3
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +41 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -338,9 +338,9 @@ interface TestdinoConfig {
|
|
|
338
338
|
*/
|
|
339
339
|
token?: string;
|
|
340
340
|
/**
|
|
341
|
-
* CI
|
|
341
|
+
* CI run ID for grouping sharded runs
|
|
342
342
|
*/
|
|
343
|
-
|
|
343
|
+
ciRunId?: string;
|
|
344
344
|
/**
|
|
345
345
|
* Server URL (for development/testing)
|
|
346
346
|
*/
|
|
@@ -378,6 +378,7 @@ interface BaseEvent {
|
|
|
378
378
|
interface TestRunBeginEvent extends BaseEvent {
|
|
379
379
|
type: 'run:begin';
|
|
380
380
|
metadata: CompleteMetadata;
|
|
381
|
+
ciRunId?: string;
|
|
381
382
|
}
|
|
382
383
|
interface TestBeginEvent extends BaseEvent {
|
|
383
384
|
type: 'test:begin';
|
package/dist/index.d.ts
CHANGED
|
@@ -338,9 +338,9 @@ interface TestdinoConfig {
|
|
|
338
338
|
*/
|
|
339
339
|
token?: string;
|
|
340
340
|
/**
|
|
341
|
-
* CI
|
|
341
|
+
* CI run ID for grouping sharded runs
|
|
342
342
|
*/
|
|
343
|
-
|
|
343
|
+
ciRunId?: string;
|
|
344
344
|
/**
|
|
345
345
|
* Server URL (for development/testing)
|
|
346
346
|
*/
|
|
@@ -378,6 +378,7 @@ interface BaseEvent {
|
|
|
378
378
|
interface TestRunBeginEvent extends BaseEvent {
|
|
379
379
|
type: 'run:begin';
|
|
380
380
|
metadata: CompleteMetadata;
|
|
381
|
+
ciRunId?: string;
|
|
381
382
|
}
|
|
382
383
|
interface TestBeginEvent extends BaseEvent {
|
|
383
384
|
type: 'test:begin';
|
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
|
/**
|
|
@@ -1783,7 +1799,7 @@ var TestdinoReporter = class {
|
|
|
1783
1799
|
mappedConfig.debug = cliConfig.debug;
|
|
1784
1800
|
}
|
|
1785
1801
|
if (cliConfig.ciRunId !== void 0 && typeof cliConfig.ciRunId === "string") {
|
|
1786
|
-
mappedConfig.
|
|
1802
|
+
mappedConfig.ciRunId = cliConfig.ciRunId;
|
|
1787
1803
|
}
|
|
1788
1804
|
if (cliConfig.artifacts !== void 0 && typeof cliConfig.artifacts === "boolean") {
|
|
1789
1805
|
mappedConfig.artifacts = cliConfig.artifacts;
|
|
@@ -1885,8 +1901,23 @@ var TestdinoReporter = class {
|
|
|
1885
1901
|
type: "run:begin",
|
|
1886
1902
|
runId: this.runId,
|
|
1887
1903
|
metadata,
|
|
1904
|
+
ciRunId: this.config.ciRunId,
|
|
1905
|
+
// Include ciRunId for shard grouping
|
|
1888
1906
|
...this.getEventMetadata()
|
|
1889
1907
|
};
|
|
1908
|
+
if (this.config.debug) {
|
|
1909
|
+
console.log(`\u{1F50D} TestDino: run:begin event details:`);
|
|
1910
|
+
console.log(` runId: ${this.runId}`);
|
|
1911
|
+
console.log(` ciRunId: ${this.config.ciRunId ?? "(not set)"}`);
|
|
1912
|
+
console.log(` shard: ${config?.shard ? `${config.shard.current}/${config.shard.total}` : "(not sharded)"}`);
|
|
1913
|
+
if (metadata.skeleton) {
|
|
1914
|
+
console.log(` skeleton.totalTests: ${metadata.skeleton.totalTests}`);
|
|
1915
|
+
console.log(` skeleton.suites: ${metadata.skeleton.suites?.length ?? 0}`);
|
|
1916
|
+
console.log(` skeleton: ${JSON.stringify(metadata.skeleton, null, 2)}`);
|
|
1917
|
+
} else {
|
|
1918
|
+
console.log(` skeleton: (not available)`);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1890
1921
|
await this.sendEvents([beginEvent]);
|
|
1891
1922
|
this.registerSignalHandlers();
|
|
1892
1923
|
return true;
|
|
@@ -2090,6 +2121,9 @@ var TestdinoReporter = class {
|
|
|
2090
2121
|
*/
|
|
2091
2122
|
async onEnd(result) {
|
|
2092
2123
|
if (this.quotaExceeded) {
|
|
2124
|
+
if (this.pendingTestEndPromises.size > 0) {
|
|
2125
|
+
await Promise.allSettled(Array.from(this.pendingTestEndPromises));
|
|
2126
|
+
}
|
|
2093
2127
|
console.log("\u2705 TestDino: Tests completed (quota limit reached; not streamed to TestDino)");
|
|
2094
2128
|
this.wsClient?.close();
|
|
2095
2129
|
this.removeSignalHandlers();
|
|
@@ -2579,7 +2613,7 @@ var TestdinoReporter = class {
|
|
|
2579
2613
|
try {
|
|
2580
2614
|
await Promise.race([
|
|
2581
2615
|
Promise.allSettled(Array.from(this.pendingTestEndPromises)),
|
|
2582
|
-
this.timeoutPromise(
|
|
2616
|
+
this.timeoutPromise(2e3, "Pending events timeout")
|
|
2583
2617
|
]);
|
|
2584
2618
|
} catch {
|
|
2585
2619
|
}
|