Skip to content

Commit

Permalink
feat: add include option in istanbul coverage (vitest-dev#1883)
Browse files Browse the repository at this point in the history
  • Loading branch information
warmthdawn committed Aug 19, 2022
1 parent 80739ca commit baf5e75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/coverage-istanbul/src/provider.ts
Expand Up @@ -60,6 +60,7 @@ export class IstanbulCoverageProvider implements CoverageProvider {

this.testExclude = new _TestExclude({
cwd: ctx.config.root,
include: typeof this.options.include === 'undefined' ? undefined : [...this.options.include],
exclude: [...defaultExclude, ...defaultInclude, ...this.options.exclude],
excludeNodeModules: true,
extension: configDefaults.coverage.extension,
Expand Down
6 changes: 5 additions & 1 deletion packages/vitest/src/types/coverage.ts
Expand Up @@ -91,6 +91,11 @@ export interface BaseCoverageOptions {
*/
reporter?: Arrayable<CoverageReporter>

/**
* List of files included in coverage as glob patterns
*/
include?: string[]

/**
* List of files excluded from coverage as glob patterns
*/
Expand Down Expand Up @@ -160,7 +165,6 @@ export interface CoverageC8Options extends BaseCoverageOptions {
* @default true
*/
excludeNodeModules?: boolean
include?: string[]

all?: boolean
src?: string[]
Expand Down

0 comments on commit baf5e75

Please sign in to comment.