@testdino/playwright 1.0.7 → 1.0.9
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/README.md +81 -6
- package/dist/cli/index.js +46 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +46 -3
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +254 -3
- package/dist/index.d.ts +254 -3
- package/dist/index.js +591 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +583 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Reporter, FullConfig, Suite, TestCase, TestResult, TestStep, FullResult, TestError } from '@playwright/test/reporter';
|
|
2
|
+
import * as playwright_test from 'playwright/test';
|
|
3
|
+
import { Page, TestInfo } from '@playwright/test';
|
|
4
|
+
export { expect } from '@playwright/test';
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Metadata collection types and interfaces
|
|
@@ -253,6 +256,194 @@ interface MetadataCollectionSummary {
|
|
|
253
256
|
failureCount: number;
|
|
254
257
|
}
|
|
255
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Coverage type definitions for TestDino Playwright integration.
|
|
261
|
+
* Istanbul-only (V8 coverage planned for future release).
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* Istanbul coverage map format (window.__coverage__).
|
|
265
|
+
* Contains structural metadata + execution counts per file.
|
|
266
|
+
* Does NOT contain source code.
|
|
267
|
+
*/
|
|
268
|
+
type IstanbulCoverageMap = Record<string, IstanbulFileCoverage>;
|
|
269
|
+
interface IstanbulFileCoverage {
|
|
270
|
+
path: string;
|
|
271
|
+
statementMap: Record<string, {
|
|
272
|
+
start: {
|
|
273
|
+
line: number;
|
|
274
|
+
column: number;
|
|
275
|
+
};
|
|
276
|
+
end: {
|
|
277
|
+
line: number;
|
|
278
|
+
column: number;
|
|
279
|
+
};
|
|
280
|
+
}>;
|
|
281
|
+
fnMap: Record<string, {
|
|
282
|
+
name: string;
|
|
283
|
+
decl: {
|
|
284
|
+
start: {
|
|
285
|
+
line: number;
|
|
286
|
+
column: number;
|
|
287
|
+
};
|
|
288
|
+
end: {
|
|
289
|
+
line: number;
|
|
290
|
+
column: number;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
loc: {
|
|
294
|
+
start: {
|
|
295
|
+
line: number;
|
|
296
|
+
column: number;
|
|
297
|
+
};
|
|
298
|
+
end: {
|
|
299
|
+
line: number;
|
|
300
|
+
column: number;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
}>;
|
|
304
|
+
branchMap: Record<string, {
|
|
305
|
+
type: string;
|
|
306
|
+
loc: {
|
|
307
|
+
start: {
|
|
308
|
+
line: number;
|
|
309
|
+
column: number;
|
|
310
|
+
};
|
|
311
|
+
end: {
|
|
312
|
+
line: number;
|
|
313
|
+
column: number;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
locations: Array<{
|
|
317
|
+
start: {
|
|
318
|
+
line: number;
|
|
319
|
+
column: number;
|
|
320
|
+
};
|
|
321
|
+
end: {
|
|
322
|
+
line: number;
|
|
323
|
+
column: number;
|
|
324
|
+
};
|
|
325
|
+
}>;
|
|
326
|
+
}>;
|
|
327
|
+
/** Statement execution counts */
|
|
328
|
+
s: Record<string, number>;
|
|
329
|
+
/** Function call counts */
|
|
330
|
+
f: Record<string, number>;
|
|
331
|
+
/** Branch path counts */
|
|
332
|
+
b: Record<string, number[]>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Coverage fragment collected per-test by the fixture.
|
|
336
|
+
* Attached to testInfo as 'testdino-coverage' attachment.
|
|
337
|
+
*/
|
|
338
|
+
interface CoverageFragment {
|
|
339
|
+
istanbul: IstanbulCoverageMap | null;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Metric with total, covered count, and optional percentage.
|
|
343
|
+
* The pct field is calculated on the server/client and not sent over the wire.
|
|
344
|
+
*/
|
|
345
|
+
interface CoverageMetric {
|
|
346
|
+
total: number;
|
|
347
|
+
covered: number;
|
|
348
|
+
/** Coverage percentage (0-100), calculated from total and covered */
|
|
349
|
+
pct: number;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Summary metrics for a coverage report.
|
|
353
|
+
*/
|
|
354
|
+
interface CoverageSummary {
|
|
355
|
+
lines: CoverageMetric;
|
|
356
|
+
branches: CoverageMetric;
|
|
357
|
+
functions: CoverageMetric;
|
|
358
|
+
statements: CoverageMetric;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Per-file coverage metrics (no source code, no raw maps).
|
|
362
|
+
*/
|
|
363
|
+
interface FileCoverage {
|
|
364
|
+
path: string;
|
|
365
|
+
lines: CoverageMetric;
|
|
366
|
+
branches: CoverageMetric;
|
|
367
|
+
functions: CoverageMetric;
|
|
368
|
+
statements: CoverageMetric;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Compact per-file hit counts for cross-shard merging.
|
|
372
|
+
* Contains only execution counts and totals — no structural maps,
|
|
373
|
+
* no source code, no line/column data.
|
|
374
|
+
*/
|
|
375
|
+
interface CompactFileCounts {
|
|
376
|
+
/** Statement execution counts */
|
|
377
|
+
s: Record<string, number>;
|
|
378
|
+
/** Function call counts */
|
|
379
|
+
f: Record<string, number>;
|
|
380
|
+
/** Branch path counts */
|
|
381
|
+
b: Record<string, number[]>;
|
|
382
|
+
/** Denominators computed from structural maps */
|
|
383
|
+
totals: {
|
|
384
|
+
s: number;
|
|
385
|
+
f: number;
|
|
386
|
+
b: number;
|
|
387
|
+
};
|
|
388
|
+
/** Hash of structural map shape for build mismatch detection */
|
|
389
|
+
shapeHash: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Compact coverage data for sharded uploads.
|
|
393
|
+
* Sent as part of coverage:data event for server-side merging.
|
|
394
|
+
*/
|
|
395
|
+
interface CompactCoverageData {
|
|
396
|
+
files: Record<string, CompactFileCounts>;
|
|
397
|
+
fileCount: number;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Coverage threshold percentages.
|
|
401
|
+
* If set, the run fails when coverage drops below these values.
|
|
402
|
+
*/
|
|
403
|
+
interface CoverageThresholds {
|
|
404
|
+
statements?: number;
|
|
405
|
+
branches?: number;
|
|
406
|
+
functions?: number;
|
|
407
|
+
lines?: number;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Coverage configuration options (part of TestdinoConfig).
|
|
411
|
+
*/
|
|
412
|
+
interface CoverageConfig {
|
|
413
|
+
/** Enable coverage collection. Default: false */
|
|
414
|
+
enabled: boolean;
|
|
415
|
+
/** Glob patterns — only files whose path matches a pattern are included */
|
|
416
|
+
include?: string[];
|
|
417
|
+
/** Glob patterns — files whose path matches a pattern are excluded */
|
|
418
|
+
exclude?: string[];
|
|
419
|
+
/** Fail the run if coverage percentages are below these thresholds */
|
|
420
|
+
thresholds?: CoverageThresholds;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
type CoverageFixtures = {
|
|
424
|
+
_testdinoCoverage: void;
|
|
425
|
+
};
|
|
426
|
+
declare const coverageFixtures: {
|
|
427
|
+
_testdinoCoverage: ((({ page }: {
|
|
428
|
+
page: Page;
|
|
429
|
+
}, use: () => Promise<void>, testInfo: TestInfo) => Promise<void>) | {
|
|
430
|
+
auto: boolean;
|
|
431
|
+
})[];
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Pre-extended test with coverage fixtures for direct import.
|
|
435
|
+
*
|
|
436
|
+
* Usage:
|
|
437
|
+
* ```typescript
|
|
438
|
+
* import { test, expect } from '@testdino/playwright';
|
|
439
|
+
*
|
|
440
|
+
* test('my test', async ({ page }) => {
|
|
441
|
+
* // coverage collected automatically
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & CoverageFixtures, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
|
|
446
|
+
|
|
256
447
|
/**
|
|
257
448
|
* Server error classes for quota and infrastructure errors
|
|
258
449
|
* These are received from the TestDino server and handled gracefully in the reporter
|
|
@@ -390,6 +581,12 @@ interface TestdinoConfig {
|
|
|
390
581
|
* Set to false or use --no-artifacts CLI flag to disable
|
|
391
582
|
*/
|
|
392
583
|
artifacts?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Coverage collection configuration.
|
|
586
|
+
* When enabled, Istanbul coverage is collected per-test via fixtures,
|
|
587
|
+
* merged in the reporter, and uploaded as metrics to the server.
|
|
588
|
+
*/
|
|
589
|
+
coverage?: CoverageConfig;
|
|
393
590
|
}
|
|
394
591
|
interface EventBuffer {
|
|
395
592
|
events: TestEvent[];
|
|
@@ -403,7 +600,7 @@ interface ConnectionConfig {
|
|
|
403
600
|
maxRetries?: number;
|
|
404
601
|
retryDelay?: number;
|
|
405
602
|
}
|
|
406
|
-
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent;
|
|
603
|
+
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent | CoverageDataEvent;
|
|
407
604
|
interface Annotation {
|
|
408
605
|
type: string;
|
|
409
606
|
description?: string;
|
|
@@ -556,6 +753,27 @@ interface TestRunEndEvent extends BaseEvent {
|
|
|
556
753
|
total: number;
|
|
557
754
|
};
|
|
558
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Coverage data event — sent after all tests complete, before run:end.
|
|
758
|
+
*
|
|
759
|
+
* Non-sharded runs: contains computed summary + per-file metrics.
|
|
760
|
+
* Sharded runs: contains compact hit counts for server-side cross-shard merging.
|
|
761
|
+
*/
|
|
762
|
+
interface CoverageDataEvent extends BaseEvent {
|
|
763
|
+
type: 'coverage:data';
|
|
764
|
+
summary: CoverageSummary;
|
|
765
|
+
files: FileCoverage[];
|
|
766
|
+
compactCounts?: CompactCoverageData;
|
|
767
|
+
metadata: {
|
|
768
|
+
instrumentationType: 'istanbul';
|
|
769
|
+
fileCount: number;
|
|
770
|
+
sharded: boolean;
|
|
771
|
+
};
|
|
772
|
+
shard?: {
|
|
773
|
+
current: number;
|
|
774
|
+
total: number;
|
|
775
|
+
};
|
|
776
|
+
}
|
|
559
777
|
interface TestRunErrorEvent extends BaseEvent {
|
|
560
778
|
type: 'run:error';
|
|
561
779
|
error: {
|
|
@@ -622,6 +840,16 @@ declare class TestdinoReporter implements Reporter {
|
|
|
622
840
|
private initFailed;
|
|
623
841
|
private pendingTestEndPromises;
|
|
624
842
|
private log;
|
|
843
|
+
private coverageEnabled;
|
|
844
|
+
private coverageMerger;
|
|
845
|
+
private warnedCoverageDisconnect;
|
|
846
|
+
private coverageThresholdFailed;
|
|
847
|
+
private testCounts;
|
|
848
|
+
private totalTests;
|
|
849
|
+
private lastCoverageEvent;
|
|
850
|
+
private projectNames;
|
|
851
|
+
private runMetadata;
|
|
852
|
+
private workerCount;
|
|
625
853
|
constructor(config?: TestdinoConfig);
|
|
626
854
|
/**
|
|
627
855
|
* Load configuration from CLI temp file if available
|
|
@@ -668,7 +896,9 @@ declare class TestdinoReporter implements Reporter {
|
|
|
668
896
|
/**
|
|
669
897
|
* Called after all tests complete
|
|
670
898
|
*/
|
|
671
|
-
onEnd(result: FullResult): Promise<
|
|
899
|
+
onEnd(result: FullResult): Promise<{
|
|
900
|
+
status?: FullResult['status'];
|
|
901
|
+
} | void>;
|
|
672
902
|
/**
|
|
673
903
|
* Called on global errors
|
|
674
904
|
*/
|
|
@@ -818,6 +1048,27 @@ declare class TestdinoReporter implements Reporter {
|
|
|
818
1048
|
* Get base server URL without /api/reporter suffix
|
|
819
1049
|
*/
|
|
820
1050
|
private getBaseServerUrl;
|
|
1051
|
+
/**
|
|
1052
|
+
* Walk up the suite hierarchy to find the project name for a test.
|
|
1053
|
+
*/
|
|
1054
|
+
private getProjectName;
|
|
1055
|
+
/**
|
|
1056
|
+
* Extract coverage fragment from test result attachments and merge incrementally.
|
|
1057
|
+
* The fixture attaches coverage as an in-memory JSON attachment named 'testdino-coverage'.
|
|
1058
|
+
*/
|
|
1059
|
+
private extractCoverageFromResult;
|
|
1060
|
+
/**
|
|
1061
|
+
* Build a coverage:data event from the merged coverage data.
|
|
1062
|
+
*
|
|
1063
|
+
* Non-sharded runs: summary + per-file metrics only (small payload).
|
|
1064
|
+
* Sharded runs: also includes compact hit counts for server-side cross-shard merging.
|
|
1065
|
+
*/
|
|
1066
|
+
private buildCoverageEvent;
|
|
1067
|
+
/**
|
|
1068
|
+
* Check coverage against configured thresholds.
|
|
1069
|
+
* Returns an array of failure messages (empty if all thresholds pass).
|
|
1070
|
+
*/
|
|
1071
|
+
private checkCoverageThresholds;
|
|
821
1072
|
}
|
|
822
1073
|
|
|
823
|
-
export { type Annotation, type BaseEvent, type CIMetadata, CircuitBreakerError, type ConnectionConfig, type EventBuffer, type GitMetadata, type MetadataCollectionResult, type MetadataCollectionSummary, type MetadataCollector, type NackMessage, type PRMetadata, type PlaywrightMetadata, QueueFullError, QuotaExceededError, QuotaExhaustedError, type CompleteMetadata as RunMetadata, type ServerError, type SessionCreationQuotaResponse, type ShardMetadata, type SystemMetadata, type TestBeginEvent, type TestConsoleErrEvent, type TestConsoleOutEvent, type TestEndEvent, type TestEvent, type TestRunBeginEvent, type TestRunEndEvent, type TestRunErrorEvent, type TestStepBeginEvent, type TestStepEndEvent, type TestdinoConfig, TestdinoReporter as default };
|
|
1074
|
+
export { type Annotation, type BaseEvent, type CIMetadata, CircuitBreakerError, type CompactCoverageData, type CompactFileCounts, type ConnectionConfig, type CoverageConfig, type CoverageDataEvent, type CoverageFragment, type CoverageMetric, type CoverageSummary, type CoverageThresholds, type EventBuffer, type FileCoverage, type GitMetadata, type IstanbulCoverageMap, type MetadataCollectionResult, type MetadataCollectionSummary, type MetadataCollector, type NackMessage, type PRMetadata, type PlaywrightMetadata, QueueFullError, QuotaExceededError, QuotaExhaustedError, type CompleteMetadata as RunMetadata, type ServerError, type SessionCreationQuotaResponse, type ShardMetadata, type SystemMetadata, type TestBeginEvent, type TestConsoleErrEvent, type TestConsoleOutEvent, type TestEndEvent, type TestEvent, type TestRunBeginEvent, type TestRunEndEvent, type TestRunErrorEvent, type TestStepBeginEvent, type TestStepEndEvent, type TestdinoConfig, coverageFixtures, TestdinoReporter as default, test };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Reporter, FullConfig, Suite, TestCase, TestResult, TestStep, FullResult, TestError } from '@playwright/test/reporter';
|
|
2
|
+
import * as playwright_test from 'playwright/test';
|
|
3
|
+
import { Page, TestInfo } from '@playwright/test';
|
|
4
|
+
export { expect } from '@playwright/test';
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Metadata collection types and interfaces
|
|
@@ -253,6 +256,194 @@ interface MetadataCollectionSummary {
|
|
|
253
256
|
failureCount: number;
|
|
254
257
|
}
|
|
255
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Coverage type definitions for TestDino Playwright integration.
|
|
261
|
+
* Istanbul-only (V8 coverage planned for future release).
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* Istanbul coverage map format (window.__coverage__).
|
|
265
|
+
* Contains structural metadata + execution counts per file.
|
|
266
|
+
* Does NOT contain source code.
|
|
267
|
+
*/
|
|
268
|
+
type IstanbulCoverageMap = Record<string, IstanbulFileCoverage>;
|
|
269
|
+
interface IstanbulFileCoverage {
|
|
270
|
+
path: string;
|
|
271
|
+
statementMap: Record<string, {
|
|
272
|
+
start: {
|
|
273
|
+
line: number;
|
|
274
|
+
column: number;
|
|
275
|
+
};
|
|
276
|
+
end: {
|
|
277
|
+
line: number;
|
|
278
|
+
column: number;
|
|
279
|
+
};
|
|
280
|
+
}>;
|
|
281
|
+
fnMap: Record<string, {
|
|
282
|
+
name: string;
|
|
283
|
+
decl: {
|
|
284
|
+
start: {
|
|
285
|
+
line: number;
|
|
286
|
+
column: number;
|
|
287
|
+
};
|
|
288
|
+
end: {
|
|
289
|
+
line: number;
|
|
290
|
+
column: number;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
loc: {
|
|
294
|
+
start: {
|
|
295
|
+
line: number;
|
|
296
|
+
column: number;
|
|
297
|
+
};
|
|
298
|
+
end: {
|
|
299
|
+
line: number;
|
|
300
|
+
column: number;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
}>;
|
|
304
|
+
branchMap: Record<string, {
|
|
305
|
+
type: string;
|
|
306
|
+
loc: {
|
|
307
|
+
start: {
|
|
308
|
+
line: number;
|
|
309
|
+
column: number;
|
|
310
|
+
};
|
|
311
|
+
end: {
|
|
312
|
+
line: number;
|
|
313
|
+
column: number;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
locations: Array<{
|
|
317
|
+
start: {
|
|
318
|
+
line: number;
|
|
319
|
+
column: number;
|
|
320
|
+
};
|
|
321
|
+
end: {
|
|
322
|
+
line: number;
|
|
323
|
+
column: number;
|
|
324
|
+
};
|
|
325
|
+
}>;
|
|
326
|
+
}>;
|
|
327
|
+
/** Statement execution counts */
|
|
328
|
+
s: Record<string, number>;
|
|
329
|
+
/** Function call counts */
|
|
330
|
+
f: Record<string, number>;
|
|
331
|
+
/** Branch path counts */
|
|
332
|
+
b: Record<string, number[]>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Coverage fragment collected per-test by the fixture.
|
|
336
|
+
* Attached to testInfo as 'testdino-coverage' attachment.
|
|
337
|
+
*/
|
|
338
|
+
interface CoverageFragment {
|
|
339
|
+
istanbul: IstanbulCoverageMap | null;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Metric with total, covered count, and optional percentage.
|
|
343
|
+
* The pct field is calculated on the server/client and not sent over the wire.
|
|
344
|
+
*/
|
|
345
|
+
interface CoverageMetric {
|
|
346
|
+
total: number;
|
|
347
|
+
covered: number;
|
|
348
|
+
/** Coverage percentage (0-100), calculated from total and covered */
|
|
349
|
+
pct: number;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Summary metrics for a coverage report.
|
|
353
|
+
*/
|
|
354
|
+
interface CoverageSummary {
|
|
355
|
+
lines: CoverageMetric;
|
|
356
|
+
branches: CoverageMetric;
|
|
357
|
+
functions: CoverageMetric;
|
|
358
|
+
statements: CoverageMetric;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Per-file coverage metrics (no source code, no raw maps).
|
|
362
|
+
*/
|
|
363
|
+
interface FileCoverage {
|
|
364
|
+
path: string;
|
|
365
|
+
lines: CoverageMetric;
|
|
366
|
+
branches: CoverageMetric;
|
|
367
|
+
functions: CoverageMetric;
|
|
368
|
+
statements: CoverageMetric;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Compact per-file hit counts for cross-shard merging.
|
|
372
|
+
* Contains only execution counts and totals — no structural maps,
|
|
373
|
+
* no source code, no line/column data.
|
|
374
|
+
*/
|
|
375
|
+
interface CompactFileCounts {
|
|
376
|
+
/** Statement execution counts */
|
|
377
|
+
s: Record<string, number>;
|
|
378
|
+
/** Function call counts */
|
|
379
|
+
f: Record<string, number>;
|
|
380
|
+
/** Branch path counts */
|
|
381
|
+
b: Record<string, number[]>;
|
|
382
|
+
/** Denominators computed from structural maps */
|
|
383
|
+
totals: {
|
|
384
|
+
s: number;
|
|
385
|
+
f: number;
|
|
386
|
+
b: number;
|
|
387
|
+
};
|
|
388
|
+
/** Hash of structural map shape for build mismatch detection */
|
|
389
|
+
shapeHash: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Compact coverage data for sharded uploads.
|
|
393
|
+
* Sent as part of coverage:data event for server-side merging.
|
|
394
|
+
*/
|
|
395
|
+
interface CompactCoverageData {
|
|
396
|
+
files: Record<string, CompactFileCounts>;
|
|
397
|
+
fileCount: number;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Coverage threshold percentages.
|
|
401
|
+
* If set, the run fails when coverage drops below these values.
|
|
402
|
+
*/
|
|
403
|
+
interface CoverageThresholds {
|
|
404
|
+
statements?: number;
|
|
405
|
+
branches?: number;
|
|
406
|
+
functions?: number;
|
|
407
|
+
lines?: number;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Coverage configuration options (part of TestdinoConfig).
|
|
411
|
+
*/
|
|
412
|
+
interface CoverageConfig {
|
|
413
|
+
/** Enable coverage collection. Default: false */
|
|
414
|
+
enabled: boolean;
|
|
415
|
+
/** Glob patterns — only files whose path matches a pattern are included */
|
|
416
|
+
include?: string[];
|
|
417
|
+
/** Glob patterns — files whose path matches a pattern are excluded */
|
|
418
|
+
exclude?: string[];
|
|
419
|
+
/** Fail the run if coverage percentages are below these thresholds */
|
|
420
|
+
thresholds?: CoverageThresholds;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
type CoverageFixtures = {
|
|
424
|
+
_testdinoCoverage: void;
|
|
425
|
+
};
|
|
426
|
+
declare const coverageFixtures: {
|
|
427
|
+
_testdinoCoverage: ((({ page }: {
|
|
428
|
+
page: Page;
|
|
429
|
+
}, use: () => Promise<void>, testInfo: TestInfo) => Promise<void>) | {
|
|
430
|
+
auto: boolean;
|
|
431
|
+
})[];
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Pre-extended test with coverage fixtures for direct import.
|
|
435
|
+
*
|
|
436
|
+
* Usage:
|
|
437
|
+
* ```typescript
|
|
438
|
+
* import { test, expect } from '@testdino/playwright';
|
|
439
|
+
*
|
|
440
|
+
* test('my test', async ({ page }) => {
|
|
441
|
+
* // coverage collected automatically
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & CoverageFixtures, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
|
|
446
|
+
|
|
256
447
|
/**
|
|
257
448
|
* Server error classes for quota and infrastructure errors
|
|
258
449
|
* These are received from the TestDino server and handled gracefully in the reporter
|
|
@@ -390,6 +581,12 @@ interface TestdinoConfig {
|
|
|
390
581
|
* Set to false or use --no-artifacts CLI flag to disable
|
|
391
582
|
*/
|
|
392
583
|
artifacts?: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Coverage collection configuration.
|
|
586
|
+
* When enabled, Istanbul coverage is collected per-test via fixtures,
|
|
587
|
+
* merged in the reporter, and uploaded as metrics to the server.
|
|
588
|
+
*/
|
|
589
|
+
coverage?: CoverageConfig;
|
|
393
590
|
}
|
|
394
591
|
interface EventBuffer {
|
|
395
592
|
events: TestEvent[];
|
|
@@ -403,7 +600,7 @@ interface ConnectionConfig {
|
|
|
403
600
|
maxRetries?: number;
|
|
404
601
|
retryDelay?: number;
|
|
405
602
|
}
|
|
406
|
-
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent;
|
|
603
|
+
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent | CoverageDataEvent;
|
|
407
604
|
interface Annotation {
|
|
408
605
|
type: string;
|
|
409
606
|
description?: string;
|
|
@@ -556,6 +753,27 @@ interface TestRunEndEvent extends BaseEvent {
|
|
|
556
753
|
total: number;
|
|
557
754
|
};
|
|
558
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Coverage data event — sent after all tests complete, before run:end.
|
|
758
|
+
*
|
|
759
|
+
* Non-sharded runs: contains computed summary + per-file metrics.
|
|
760
|
+
* Sharded runs: contains compact hit counts for server-side cross-shard merging.
|
|
761
|
+
*/
|
|
762
|
+
interface CoverageDataEvent extends BaseEvent {
|
|
763
|
+
type: 'coverage:data';
|
|
764
|
+
summary: CoverageSummary;
|
|
765
|
+
files: FileCoverage[];
|
|
766
|
+
compactCounts?: CompactCoverageData;
|
|
767
|
+
metadata: {
|
|
768
|
+
instrumentationType: 'istanbul';
|
|
769
|
+
fileCount: number;
|
|
770
|
+
sharded: boolean;
|
|
771
|
+
};
|
|
772
|
+
shard?: {
|
|
773
|
+
current: number;
|
|
774
|
+
total: number;
|
|
775
|
+
};
|
|
776
|
+
}
|
|
559
777
|
interface TestRunErrorEvent extends BaseEvent {
|
|
560
778
|
type: 'run:error';
|
|
561
779
|
error: {
|
|
@@ -622,6 +840,16 @@ declare class TestdinoReporter implements Reporter {
|
|
|
622
840
|
private initFailed;
|
|
623
841
|
private pendingTestEndPromises;
|
|
624
842
|
private log;
|
|
843
|
+
private coverageEnabled;
|
|
844
|
+
private coverageMerger;
|
|
845
|
+
private warnedCoverageDisconnect;
|
|
846
|
+
private coverageThresholdFailed;
|
|
847
|
+
private testCounts;
|
|
848
|
+
private totalTests;
|
|
849
|
+
private lastCoverageEvent;
|
|
850
|
+
private projectNames;
|
|
851
|
+
private runMetadata;
|
|
852
|
+
private workerCount;
|
|
625
853
|
constructor(config?: TestdinoConfig);
|
|
626
854
|
/**
|
|
627
855
|
* Load configuration from CLI temp file if available
|
|
@@ -668,7 +896,9 @@ declare class TestdinoReporter implements Reporter {
|
|
|
668
896
|
/**
|
|
669
897
|
* Called after all tests complete
|
|
670
898
|
*/
|
|
671
|
-
onEnd(result: FullResult): Promise<
|
|
899
|
+
onEnd(result: FullResult): Promise<{
|
|
900
|
+
status?: FullResult['status'];
|
|
901
|
+
} | void>;
|
|
672
902
|
/**
|
|
673
903
|
* Called on global errors
|
|
674
904
|
*/
|
|
@@ -818,6 +1048,27 @@ declare class TestdinoReporter implements Reporter {
|
|
|
818
1048
|
* Get base server URL without /api/reporter suffix
|
|
819
1049
|
*/
|
|
820
1050
|
private getBaseServerUrl;
|
|
1051
|
+
/**
|
|
1052
|
+
* Walk up the suite hierarchy to find the project name for a test.
|
|
1053
|
+
*/
|
|
1054
|
+
private getProjectName;
|
|
1055
|
+
/**
|
|
1056
|
+
* Extract coverage fragment from test result attachments and merge incrementally.
|
|
1057
|
+
* The fixture attaches coverage as an in-memory JSON attachment named 'testdino-coverage'.
|
|
1058
|
+
*/
|
|
1059
|
+
private extractCoverageFromResult;
|
|
1060
|
+
/**
|
|
1061
|
+
* Build a coverage:data event from the merged coverage data.
|
|
1062
|
+
*
|
|
1063
|
+
* Non-sharded runs: summary + per-file metrics only (small payload).
|
|
1064
|
+
* Sharded runs: also includes compact hit counts for server-side cross-shard merging.
|
|
1065
|
+
*/
|
|
1066
|
+
private buildCoverageEvent;
|
|
1067
|
+
/**
|
|
1068
|
+
* Check coverage against configured thresholds.
|
|
1069
|
+
* Returns an array of failure messages (empty if all thresholds pass).
|
|
1070
|
+
*/
|
|
1071
|
+
private checkCoverageThresholds;
|
|
821
1072
|
}
|
|
822
1073
|
|
|
823
|
-
export { type Annotation, type BaseEvent, type CIMetadata, CircuitBreakerError, type ConnectionConfig, type EventBuffer, type GitMetadata, type MetadataCollectionResult, type MetadataCollectionSummary, type MetadataCollector, type NackMessage, type PRMetadata, type PlaywrightMetadata, QueueFullError, QuotaExceededError, QuotaExhaustedError, type CompleteMetadata as RunMetadata, type ServerError, type SessionCreationQuotaResponse, type ShardMetadata, type SystemMetadata, type TestBeginEvent, type TestConsoleErrEvent, type TestConsoleOutEvent, type TestEndEvent, type TestEvent, type TestRunBeginEvent, type TestRunEndEvent, type TestRunErrorEvent, type TestStepBeginEvent, type TestStepEndEvent, type TestdinoConfig, TestdinoReporter as default };
|
|
1074
|
+
export { type Annotation, type BaseEvent, type CIMetadata, CircuitBreakerError, type CompactCoverageData, type CompactFileCounts, type ConnectionConfig, type CoverageConfig, type CoverageDataEvent, type CoverageFragment, type CoverageMetric, type CoverageSummary, type CoverageThresholds, type EventBuffer, type FileCoverage, type GitMetadata, type IstanbulCoverageMap, type MetadataCollectionResult, type MetadataCollectionSummary, type MetadataCollector, type NackMessage, type PRMetadata, type PlaywrightMetadata, QueueFullError, QuotaExceededError, QuotaExhaustedError, type CompleteMetadata as RunMetadata, type ServerError, type SessionCreationQuotaResponse, type ShardMetadata, type SystemMetadata, type TestBeginEvent, type TestConsoleErrEvent, type TestConsoleOutEvent, type TestEndEvent, type TestEvent, type TestRunBeginEvent, type TestRunEndEvent, type TestRunErrorEvent, type TestStepBeginEvent, type TestStepEndEvent, type TestdinoConfig, coverageFixtures, TestdinoReporter as default, test };
|