-
-
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(cli):
--coverage.all=false
resolved incorrectly (#4697)
- Loading branch information
1 parent
7c19664
commit a7931bb
Showing
5 changed files
with
49 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { test } from 'vitest' | ||
import type { UserConfig } from 'vitest/config' | ||
|
||
/* eslint-disable no-console, unused-imports/no-unused-vars */ | ||
|
||
test('logs resolved configuration', async () => { | ||
// @ts-expect-error -- internal | ||
const { snapshotOptions, ...config }: UserConfig['test'] = globalThis.__vitest_worker__.config | ||
|
||
// Log options that are tested | ||
log('coverage.enabled', config.coverage?.enabled) | ||
|
||
if(config.coverage?.provider === "istanbul" || config.coverage?.provider === "v8") | ||
log('coverage.all', config.coverage?.all) | ||
}) | ||
|
||
function log(label: string, value: unknown) { | ||
console.log(label, value, typeof value) | ||
} |
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,25 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
import * as testUtils from '../../test-utils' | ||
|
||
function runVitestCli(...cliArgs: string[]) { | ||
return testUtils.runVitestCli('--root', 'fixtures', 'run', 'test/log-output.test.ts', ...cliArgs) | ||
} | ||
|
||
test('--coverage', async () => { | ||
const { stdout } = await runVitestCli('--coverage') | ||
|
||
expect(stdout).toMatch('coverage.enabled true boolean') | ||
}) | ||
|
||
test('--coverage.all=false', async () => { | ||
const { stdout } = await runVitestCli('--coverage.enabled', '--coverage.all=false') | ||
|
||
expect(stdout).toMatch('coverage.all false boolean') | ||
}) | ||
|
||
test('--coverage.all', async () => { | ||
const { stdout } = await runVitestCli('--coverage.enabled', '--coverage.all') | ||
|
||
expect(stdout).toMatch('coverage.all true boolean') | ||
}) |
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 |
---|---|---|
|
@@ -9,5 +9,8 @@ export default defineConfig({ | |
chaiConfig: { | ||
truncateThreshold: 999, | ||
}, | ||
coverage: { | ||
reporter: [], | ||
}, | ||
}, | ||
}) |