-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
coverage.ts
124 lines (102 loc) · 2.76 KB
/
coverage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import type { Arrayable } from './general'
export type CoverageReporter =
| 'clover'
| 'cobertura'
| 'html-spa'
| 'html'
| 'json-summary'
| 'json'
| 'lcov'
| 'lcovonly'
| 'none'
| 'teamcity'
| 'text-lcov'
| 'text-summary'
| 'text'
export type CoverageOptions =
| NullCoverageOptions & { provider?: null }
| C8Options & { provider?: 'c8' }
| IstanbulOptions & { provider?: 'istanbul' }
interface BaseCoverageOptions {
/**
* Enable coverage, pass `--coverage` to enable
*
* @default false
*/
enabled?: boolean
/**
* Clean coverage before running tests
*
* @default true
*/
clean?: boolean
/**
* Clean coverage report on watch rerun
*
* @default false
*/
cleanOnRerun?: boolean
/**
* Directory to write coverage report to
*/
reportsDirectory?: string
/**
* Reporters
*
* @default 'text'
*/
reporter?: Arrayable<CoverageReporter>
}
export interface NullCoverageOptions extends BaseCoverageOptions {
enabled: false
}
export interface IstanbulOptions extends BaseCoverageOptions {
/* Report boolean value of logical expressions. (optional, default false) */
reportLogic?: boolean
/* Preserve comments in output. (optional, default false) */
preserveComments?: boolean
/* Generate compact code. (optional, default true) */
compact?: boolean
/* Set to true to instrument ES6 modules. (optional, default false) */
esModules?: boolean
/* Set to true to allow return statements outside of functions. (optional, default false) */
autoWrap?: boolean
/* Set to true to produce a source map for the instrumented code. (optional, default false) */
produceSourceMap?: boolean
/* Set to array of class method names to ignore for coverage. (optional, default []) */
ignoreClassMethods?: string[]
/* A callback function that is called when a source map URL. is found in the original code. This function is called with the source file name and the source map URL. (optional, default null) */
sourceMapUrlCallback?: Function
/* Turn debugging on. (optional, default false) */
debug?: boolean
/* Set babel parser plugins, see @istanbuljs/schema for defaults. */
parserPlugins?: string[]
}
export interface C8Options extends BaseCoverageOptions {
/**
* Allow files from outside of your cwd.
*
* @default false
*/
allowExternal?: any
/**
* Exclude coverage under /node_modules/
*
* @default true
*/
excludeNodeModules?: boolean
exclude?: string[]
include?: string[]
skipFull?: boolean
extension?: string | string[]
all?: boolean
src?: string[]
100?: boolean
lines?: number
functions?: number
branches?: number
statements?: number
}
export type ResolvedCoverageOptions =
& { tempDirectory: string }
& Required<CoverageOptions>