-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(coverage): global thresholds to include files from glob thresholds (
#6172) Co-authored-by: Ari Perkkiö <[email protected]>
- Loading branch information
1 parent
807a2cb
commit 02e3f00
Showing
4 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { expect } from 'vitest' | ||
import { coverageTest, isV8Provider, normalizeURL, runVitest, test } from '../utils' | ||
import { sum } from '../fixtures/src/math' | ||
import { isEven, isOdd } from '../fixtures/src/even' | ||
|
||
test('threshold glob patterns count in global coverage', async () => { | ||
await runVitest({ | ||
include: [normalizeURL(import.meta.url)], | ||
coverage: { | ||
all: false, | ||
include: ['**/fixtures/src/**'], | ||
thresholds: { | ||
'branches': 100, | ||
'functions': 50, | ||
'lines': isV8Provider() ? 66 : 50, | ||
'statements': isV8Provider() ? 66 : 50, | ||
|
||
'**/fixtures/src/even.ts': { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
|
||
coverageTest('cover some lines, but not too much', () => { | ||
expect(sum(1, 2)).toBe(3) | ||
expect(isEven(4)).toBe(true) | ||
expect(isOdd(4)).toBe(false) | ||
}) |