@testdino/playwright 1.0.7 → 1.0.8
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 +52 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +52 -3
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +262 -3
- package/dist/index.d.ts +262 -3
- package/dist/index.js +600 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +593 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -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,200 @@ 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
|
+
/** Filter which Playwright projects report coverage */
|
|
416
|
+
projects?: string[];
|
|
417
|
+
/** Generate local HTML report using istanbul-reports. Default: false */
|
|
418
|
+
localReport?: boolean;
|
|
419
|
+
/** Output directory for local HTML report. Default: './testdino-coverage' */
|
|
420
|
+
localReportDir?: string;
|
|
421
|
+
/** Substring patterns — only files whose path contains a pattern are included */
|
|
422
|
+
include?: string[];
|
|
423
|
+
/** Substring patterns — files whose path contains a pattern are excluded */
|
|
424
|
+
exclude?: string[];
|
|
425
|
+
/** Fail the run if coverage percentages are below these thresholds */
|
|
426
|
+
thresholds?: CoverageThresholds;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
type CoverageFixtures = {
|
|
430
|
+
_testdinoCoverage: void;
|
|
431
|
+
};
|
|
432
|
+
declare const coverageFixtures: {
|
|
433
|
+
_testdinoCoverage: ((({ page }: {
|
|
434
|
+
page: Page;
|
|
435
|
+
}, use: () => Promise<void>, testInfo: TestInfo) => Promise<void>) | {
|
|
436
|
+
auto: boolean;
|
|
437
|
+
})[];
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Pre-extended test with coverage fixtures for direct import.
|
|
441
|
+
*
|
|
442
|
+
* Usage:
|
|
443
|
+
* ```typescript
|
|
444
|
+
* import { test, expect } from '@testdino/playwright';
|
|
445
|
+
*
|
|
446
|
+
* test('my test', async ({ page }) => {
|
|
447
|
+
* // coverage collected automatically
|
|
448
|
+
* });
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & CoverageFixtures, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
|
|
452
|
+
|
|
256
453
|
/**
|
|
257
454
|
* Server error classes for quota and infrastructure errors
|
|
258
455
|
* These are received from the TestDino server and handled gracefully in the reporter
|
|
@@ -390,6 +587,12 @@ interface TestdinoConfig {
|
|
|
390
587
|
* Set to false or use --no-artifacts CLI flag to disable
|
|
391
588
|
*/
|
|
392
589
|
artifacts?: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Coverage collection configuration.
|
|
592
|
+
* When enabled, Istanbul coverage is collected per-test via fixtures,
|
|
593
|
+
* merged in the reporter, and uploaded as metrics to the server.
|
|
594
|
+
*/
|
|
595
|
+
coverage?: CoverageConfig;
|
|
393
596
|
}
|
|
394
597
|
interface EventBuffer {
|
|
395
598
|
events: TestEvent[];
|
|
@@ -403,7 +606,7 @@ interface ConnectionConfig {
|
|
|
403
606
|
maxRetries?: number;
|
|
404
607
|
retryDelay?: number;
|
|
405
608
|
}
|
|
406
|
-
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent;
|
|
609
|
+
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent | CoverageDataEvent;
|
|
407
610
|
interface Annotation {
|
|
408
611
|
type: string;
|
|
409
612
|
description?: string;
|
|
@@ -556,6 +759,27 @@ interface TestRunEndEvent extends BaseEvent {
|
|
|
556
759
|
total: number;
|
|
557
760
|
};
|
|
558
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Coverage data event — sent after all tests complete, before run:end.
|
|
764
|
+
*
|
|
765
|
+
* Non-sharded runs: contains computed summary + per-file metrics.
|
|
766
|
+
* Sharded runs: contains compact hit counts for server-side cross-shard merging.
|
|
767
|
+
*/
|
|
768
|
+
interface CoverageDataEvent extends BaseEvent {
|
|
769
|
+
type: 'coverage:data';
|
|
770
|
+
summary: CoverageSummary;
|
|
771
|
+
files: FileCoverage[];
|
|
772
|
+
compactCounts?: CompactCoverageData;
|
|
773
|
+
metadata: {
|
|
774
|
+
instrumentationType: 'istanbul';
|
|
775
|
+
fileCount: number;
|
|
776
|
+
sharded: boolean;
|
|
777
|
+
};
|
|
778
|
+
shard?: {
|
|
779
|
+
current: number;
|
|
780
|
+
total: number;
|
|
781
|
+
};
|
|
782
|
+
}
|
|
559
783
|
interface TestRunErrorEvent extends BaseEvent {
|
|
560
784
|
type: 'run:error';
|
|
561
785
|
error: {
|
|
@@ -622,6 +846,16 @@ declare class TestdinoReporter implements Reporter {
|
|
|
622
846
|
private initFailed;
|
|
623
847
|
private pendingTestEndPromises;
|
|
624
848
|
private log;
|
|
849
|
+
private coverageEnabled;
|
|
850
|
+
private coverageMerger;
|
|
851
|
+
private warnedCoverageDisconnect;
|
|
852
|
+
private coverageThresholdFailed;
|
|
853
|
+
private testCounts;
|
|
854
|
+
private totalTests;
|
|
855
|
+
private lastCoverageEvent;
|
|
856
|
+
private projectNames;
|
|
857
|
+
private runMetadata;
|
|
858
|
+
private workerCount;
|
|
625
859
|
constructor(config?: TestdinoConfig);
|
|
626
860
|
/**
|
|
627
861
|
* Load configuration from CLI temp file if available
|
|
@@ -668,7 +902,9 @@ declare class TestdinoReporter implements Reporter {
|
|
|
668
902
|
/**
|
|
669
903
|
* Called after all tests complete
|
|
670
904
|
*/
|
|
671
|
-
onEnd(result: FullResult): Promise<
|
|
905
|
+
onEnd(result: FullResult): Promise<{
|
|
906
|
+
status?: FullResult['status'];
|
|
907
|
+
} | void>;
|
|
672
908
|
/**
|
|
673
909
|
* Called on global errors
|
|
674
910
|
*/
|
|
@@ -818,6 +1054,29 @@ declare class TestdinoReporter implements Reporter {
|
|
|
818
1054
|
* Get base server URL without /api/reporter suffix
|
|
819
1055
|
*/
|
|
820
1056
|
private getBaseServerUrl;
|
|
1057
|
+
/**
|
|
1058
|
+
* Walk up the suite hierarchy to find the project name for a test.
|
|
1059
|
+
*/
|
|
1060
|
+
private getProjectName;
|
|
1061
|
+
/**
|
|
1062
|
+
* Extract coverage fragment from test result attachments and merge incrementally.
|
|
1063
|
+
* The fixture attaches coverage as an in-memory JSON attachment named 'testdino-coverage'.
|
|
1064
|
+
*
|
|
1065
|
+
* Respects coverage.projects filter to avoid duplicate coverage from multiple browser projects.
|
|
1066
|
+
*/
|
|
1067
|
+
private extractCoverageFromResult;
|
|
1068
|
+
/**
|
|
1069
|
+
* Build a coverage:data event from the merged coverage data.
|
|
1070
|
+
*
|
|
1071
|
+
* Non-sharded runs: summary + per-file metrics only (small payload).
|
|
1072
|
+
* Sharded runs: also includes compact hit counts for server-side cross-shard merging.
|
|
1073
|
+
*/
|
|
1074
|
+
private buildCoverageEvent;
|
|
1075
|
+
/**
|
|
1076
|
+
* Check coverage against configured thresholds.
|
|
1077
|
+
* Returns an array of failure messages (empty if all thresholds pass).
|
|
1078
|
+
*/
|
|
1079
|
+
private checkCoverageThresholds;
|
|
821
1080
|
}
|
|
822
1081
|
|
|
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 };
|
|
1082
|
+
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,200 @@ 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
|
+
/** Filter which Playwright projects report coverage */
|
|
416
|
+
projects?: string[];
|
|
417
|
+
/** Generate local HTML report using istanbul-reports. Default: false */
|
|
418
|
+
localReport?: boolean;
|
|
419
|
+
/** Output directory for local HTML report. Default: './testdino-coverage' */
|
|
420
|
+
localReportDir?: string;
|
|
421
|
+
/** Substring patterns — only files whose path contains a pattern are included */
|
|
422
|
+
include?: string[];
|
|
423
|
+
/** Substring patterns — files whose path contains a pattern are excluded */
|
|
424
|
+
exclude?: string[];
|
|
425
|
+
/** Fail the run if coverage percentages are below these thresholds */
|
|
426
|
+
thresholds?: CoverageThresholds;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
type CoverageFixtures = {
|
|
430
|
+
_testdinoCoverage: void;
|
|
431
|
+
};
|
|
432
|
+
declare const coverageFixtures: {
|
|
433
|
+
_testdinoCoverage: ((({ page }: {
|
|
434
|
+
page: Page;
|
|
435
|
+
}, use: () => Promise<void>, testInfo: TestInfo) => Promise<void>) | {
|
|
436
|
+
auto: boolean;
|
|
437
|
+
})[];
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Pre-extended test with coverage fixtures for direct import.
|
|
441
|
+
*
|
|
442
|
+
* Usage:
|
|
443
|
+
* ```typescript
|
|
444
|
+
* import { test, expect } from '@testdino/playwright';
|
|
445
|
+
*
|
|
446
|
+
* test('my test', async ({ page }) => {
|
|
447
|
+
* // coverage collected automatically
|
|
448
|
+
* });
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & CoverageFixtures, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
|
|
452
|
+
|
|
256
453
|
/**
|
|
257
454
|
* Server error classes for quota and infrastructure errors
|
|
258
455
|
* These are received from the TestDino server and handled gracefully in the reporter
|
|
@@ -390,6 +587,12 @@ interface TestdinoConfig {
|
|
|
390
587
|
* Set to false or use --no-artifacts CLI flag to disable
|
|
391
588
|
*/
|
|
392
589
|
artifacts?: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* Coverage collection configuration.
|
|
592
|
+
* When enabled, Istanbul coverage is collected per-test via fixtures,
|
|
593
|
+
* merged in the reporter, and uploaded as metrics to the server.
|
|
594
|
+
*/
|
|
595
|
+
coverage?: CoverageConfig;
|
|
393
596
|
}
|
|
394
597
|
interface EventBuffer {
|
|
395
598
|
events: TestEvent[];
|
|
@@ -403,7 +606,7 @@ interface ConnectionConfig {
|
|
|
403
606
|
maxRetries?: number;
|
|
404
607
|
retryDelay?: number;
|
|
405
608
|
}
|
|
406
|
-
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent;
|
|
609
|
+
type TestEvent = TestRunBeginEvent | TestBeginEvent | TestStepBeginEvent | TestStepEndEvent | TestEndEvent | TestRunEndEvent | TestRunErrorEvent | TestConsoleOutEvent | TestConsoleErrEvent | CoverageDataEvent;
|
|
407
610
|
interface Annotation {
|
|
408
611
|
type: string;
|
|
409
612
|
description?: string;
|
|
@@ -556,6 +759,27 @@ interface TestRunEndEvent extends BaseEvent {
|
|
|
556
759
|
total: number;
|
|
557
760
|
};
|
|
558
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Coverage data event — sent after all tests complete, before run:end.
|
|
764
|
+
*
|
|
765
|
+
* Non-sharded runs: contains computed summary + per-file metrics.
|
|
766
|
+
* Sharded runs: contains compact hit counts for server-side cross-shard merging.
|
|
767
|
+
*/
|
|
768
|
+
interface CoverageDataEvent extends BaseEvent {
|
|
769
|
+
type: 'coverage:data';
|
|
770
|
+
summary: CoverageSummary;
|
|
771
|
+
files: FileCoverage[];
|
|
772
|
+
compactCounts?: CompactCoverageData;
|
|
773
|
+
metadata: {
|
|
774
|
+
instrumentationType: 'istanbul';
|
|
775
|
+
fileCount: number;
|
|
776
|
+
sharded: boolean;
|
|
777
|
+
};
|
|
778
|
+
shard?: {
|
|
779
|
+
current: number;
|
|
780
|
+
total: number;
|
|
781
|
+
};
|
|
782
|
+
}
|
|
559
783
|
interface TestRunErrorEvent extends BaseEvent {
|
|
560
784
|
type: 'run:error';
|
|
561
785
|
error: {
|
|
@@ -622,6 +846,16 @@ declare class TestdinoReporter implements Reporter {
|
|
|
622
846
|
private initFailed;
|
|
623
847
|
private pendingTestEndPromises;
|
|
624
848
|
private log;
|
|
849
|
+
private coverageEnabled;
|
|
850
|
+
private coverageMerger;
|
|
851
|
+
private warnedCoverageDisconnect;
|
|
852
|
+
private coverageThresholdFailed;
|
|
853
|
+
private testCounts;
|
|
854
|
+
private totalTests;
|
|
855
|
+
private lastCoverageEvent;
|
|
856
|
+
private projectNames;
|
|
857
|
+
private runMetadata;
|
|
858
|
+
private workerCount;
|
|
625
859
|
constructor(config?: TestdinoConfig);
|
|
626
860
|
/**
|
|
627
861
|
* Load configuration from CLI temp file if available
|
|
@@ -668,7 +902,9 @@ declare class TestdinoReporter implements Reporter {
|
|
|
668
902
|
/**
|
|
669
903
|
* Called after all tests complete
|
|
670
904
|
*/
|
|
671
|
-
onEnd(result: FullResult): Promise<
|
|
905
|
+
onEnd(result: FullResult): Promise<{
|
|
906
|
+
status?: FullResult['status'];
|
|
907
|
+
} | void>;
|
|
672
908
|
/**
|
|
673
909
|
* Called on global errors
|
|
674
910
|
*/
|
|
@@ -818,6 +1054,29 @@ declare class TestdinoReporter implements Reporter {
|
|
|
818
1054
|
* Get base server URL without /api/reporter suffix
|
|
819
1055
|
*/
|
|
820
1056
|
private getBaseServerUrl;
|
|
1057
|
+
/**
|
|
1058
|
+
* Walk up the suite hierarchy to find the project name for a test.
|
|
1059
|
+
*/
|
|
1060
|
+
private getProjectName;
|
|
1061
|
+
/**
|
|
1062
|
+
* Extract coverage fragment from test result attachments and merge incrementally.
|
|
1063
|
+
* The fixture attaches coverage as an in-memory JSON attachment named 'testdino-coverage'.
|
|
1064
|
+
*
|
|
1065
|
+
* Respects coverage.projects filter to avoid duplicate coverage from multiple browser projects.
|
|
1066
|
+
*/
|
|
1067
|
+
private extractCoverageFromResult;
|
|
1068
|
+
/**
|
|
1069
|
+
* Build a coverage:data event from the merged coverage data.
|
|
1070
|
+
*
|
|
1071
|
+
* Non-sharded runs: summary + per-file metrics only (small payload).
|
|
1072
|
+
* Sharded runs: also includes compact hit counts for server-side cross-shard merging.
|
|
1073
|
+
*/
|
|
1074
|
+
private buildCoverageEvent;
|
|
1075
|
+
/**
|
|
1076
|
+
* Check coverage against configured thresholds.
|
|
1077
|
+
* Returns an array of failure messages (empty if all thresholds pass).
|
|
1078
|
+
*/
|
|
1079
|
+
private checkCoverageThresholds;
|
|
821
1080
|
}
|
|
822
1081
|
|
|
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 };
|
|
1082
|
+
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 };
|