@@ -6,63 +6,57 @@ export type CoverageType = z.infer<typeof coverageTypeSchema>;
6
6
export const coverageResultSchema = z . union ( [
7
7
z . object ( {
8
8
resultsPath : z
9
- . string ( {
10
- description : 'Path to coverage results for Nx setup.' ,
11
- } )
12
- . includes ( 'lcov' ) ,
9
+ . string ( )
10
+ . includes ( 'lcov' )
11
+ . describe ( 'Path to coverage results for Nx setup.' ) ,
13
12
pathToProject : z
14
- . string ( {
15
- description :
16
- 'Path from workspace root to project root. Necessary for LCOV reports which provide a relative path.' ,
17
- } )
13
+ . string ( )
14
+ . describe (
15
+ 'Path from workspace root to project root. Necessary for LCOV reports which provide a relative path.' ,
16
+ )
18
17
. optional ( ) ,
19
18
} ) ,
20
19
z
21
- . string ( {
22
- description : 'Path to coverage results for a single project setup.' ,
23
- } )
24
- . includes ( 'lcov' ) ,
20
+ . string ( )
21
+ . includes ( 'lcov' )
22
+ . describe ( 'Path to coverage results for a single project setup.' ) ,
25
23
] ) ;
26
24
export type CoverageResult = z . infer < typeof coverageResultSchema > ;
27
25
28
26
export const coveragePluginConfigSchema = z . object ( {
29
27
coverageToolCommand : z
30
28
. object ( {
31
- command : z
32
- . string ( { description : 'Command to run coverage tool.' } )
33
- . min ( 1 ) ,
29
+ command : z . string ( ) . min ( 1 ) . describe ( 'Command to run coverage tool.' ) ,
34
30
args : z
35
- . array ( z . string ( ) , {
36
- description : 'Arguments to be passed to the coverage tool.' ,
37
- } )
38
- . optional ( ) ,
31
+ . array ( z . string ( ) )
32
+ . optional ( )
33
+ . describe ( 'Arguments to be passed to the coverage tool.' ) ,
39
34
} )
40
35
. optional ( ) ,
41
36
continueOnCommandFail : z
42
- . boolean ( {
43
- description :
44
- 'Continue on coverage tool command failure or error. Defaults to true.' ,
45
- } )
46
- . default ( true ) ,
37
+ . boolean ( )
38
+ . default ( true )
39
+ . describe (
40
+ 'Continue on coverage tool command failure or error. Defaults to true.' ,
41
+ ) ,
47
42
coverageTypes : z
48
- . array ( coverageTypeSchema , {
49
- description : 'Coverage types measured. Defaults to all available types.' ,
50
- } )
43
+ . array ( coverageTypeSchema )
51
44
. min ( 1 )
52
- . default ( [ 'function' , 'branch' , 'line' ] ) ,
45
+ . default ( [ 'function' , 'branch' , 'line' ] )
46
+ . describe ( 'Coverage types measured. Defaults to all available types.' ) ,
53
47
reports : z
54
- . array ( coverageResultSchema , {
55
- description :
56
- 'Path to all code coverage report files. Only LCOV format is supported for now.' ,
57
- } )
58
- . min ( 1 ) ,
48
+ . array ( coverageResultSchema )
49
+ . min ( 1 )
50
+ . describe (
51
+ 'Path to all code coverage report files. Only LCOV format is supported for now.' ,
52
+ ) ,
59
53
perfectScoreThreshold : z
60
- . number ( {
61
- description :
62
- 'Score will be 1 (perfect) for this coverage and above. Score range is 0 - 1.' ,
63
- } )
54
+ . number ( )
64
55
. gt ( 0 )
65
56
. max ( 1 )
57
+ . describe (
58
+ 'Score will be 1 (perfect) for this coverage and above. Score range is 0 - 1.' ,
59
+ )
66
60
. optional ( ) ,
67
61
} ) ;
68
62
export type CoveragePluginConfig = z . input < typeof coveragePluginConfigSchema > ;
0 commit comments