Skip to content

Commit 730af0b

Browse files
authoredApr 27, 2023
feat(coverage): watermarks for c8 (#3254)
1 parent efce3b4 commit 730af0b

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed
 

‎docs/config/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ See [istanbul documentation](https://github.com/istanbuljs/nyc#ignoring-methods)
902902
}
903903
```
904904

905-
- **Available for providers:** `'istanbul'`
905+
- **Available for providers:** `'c8' | 'istanbul'`
906906

907907
Watermarks for statements, lines, branches and functions. See [istanbul documentation](https://github.com/istanbuljs/nyc#high-and-low-watermarks) for more information.
908908

‎packages/vitest/src/types/coverage.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,18 @@ export interface BaseCoverageOptions {
187187
*/
188188
statements?: number
189189

190+
/**
191+
* Watermarks for statements, lines, branches and functions.
192+
*
193+
* Default value is `[50,80]` for each property.
194+
*/
195+
watermarks?: {
196+
statements?: [number, number]
197+
functions?: [number, number]
198+
branches?: [number, number]
199+
lines?: [number, number]
200+
}
201+
190202
/**
191203
* Update threshold values automatically when current coverage is higher than earlier thresholds
192204
*
@@ -202,18 +214,6 @@ export interface CoverageIstanbulOptions extends BaseCoverageOptions {
202214
* @default []
203215
*/
204216
ignoreClassMethods?: string[]
205-
206-
/**
207-
* Watermarks for statements, lines, branches and functions.
208-
*
209-
* Default value is `[50,80]` for each property.
210-
*/
211-
watermarks?: {
212-
statements?: [number, number]
213-
functions?: [number, number]
214-
branches?: [number, number]
215-
lines?: [number, number]
216-
}
217217
}
218218

219219
export interface CoverageC8Options extends BaseCoverageOptions {

‎test/coverage-test/test/configuration-options.test-d.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@ test('provider options, generic', () => {
2626
provider: 'c8',
2727
enabled: true,
2828
include: ['string'],
29+
watermarks: {
30+
functions: [80, 95],
31+
lines: [80, 95],
32+
},
2933
})
3034

3135
assertType<Coverage>({
3236
provider: 'istanbul',
3337
enabled: true,
3438
include: ['string'],
39+
watermarks: {
40+
statements: [80, 95],
41+
},
3542
})
3643
})
3744

@@ -55,12 +62,6 @@ test('provider specific options, istanbul', () => {
5562
assertType<Coverage>({
5663
provider: 'istanbul',
5764
ignoreClassMethods: ['string'],
58-
watermarks: {
59-
statements: [80, 95],
60-
functions: [80, 95],
61-
branches: [80, 95],
62-
lines: [80, 95],
63-
},
6465
})
6566

6667
assertType<Coverage>({

0 commit comments

Comments
 (0)
Please sign in to comment.