-
-
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): support overriding
exclude
- Loading branch information
1 parent
d7f23d0
commit 9ee4549
Showing
4 changed files
with
45 additions
and
14 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,39 @@ | ||
import { expect } from 'vitest' | ||
import { coverageTest, normalizeURL, readCoverageMap, runVitest, test } from '../utils' | ||
|
||
test('default exclude should ignore test files', async () => { | ||
await runVitest({ | ||
include: [normalizeURL(import.meta.url)], | ||
coverage: { | ||
all: true, | ||
reporter: 'json', | ||
include: ['fixtures/test/math.test.ts'], | ||
}, | ||
}) | ||
|
||
const coverageMap = await readCoverageMap() | ||
expect(coverageMap.files()).toMatchInlineSnapshot(`[]`) | ||
}) | ||
|
||
test('overriden exclude should not apply defaults', async () => { | ||
await runVitest({ | ||
include: [normalizeURL(import.meta.url)], | ||
coverage: { | ||
all: true, | ||
reporter: 'json', | ||
include: ['fixtures/test/math.test.ts'], | ||
exclude: ['dont-match-anything'], | ||
}, | ||
}) | ||
|
||
const coverageMap = await readCoverageMap() | ||
expect(coverageMap.files()).toMatchInlineSnapshot(` | ||
[ | ||
"<process-cwd>/fixtures/test/math.test.ts", | ||
] | ||
`) | ||
}) | ||
|
||
coverageTest('dummy', () => { | ||
expect(1 + 1).toBe(2) | ||
}) |