interface BaseCoverageOptions {
    all?: boolean;
    allowExternal?: boolean;
    clean?: boolean;
    cleanOnRerun?: boolean;
    enabled?: boolean;
    exclude?: string[];
    extension?: string | string[];
    include?: string[];
    processingConcurrency?: number;
    reportOnFailure?: boolean;
    reporter?: Arrayable<(keyof ReportOptions)> | (keyof ReportOptions | [keyof ReportOptions] | ["html", Partial<HtmlOptions>] | ["text", Partial<TextOptions>] | ... 10 more ... | [...])[];
    reportsDirectory?: string;
    skipFull?: boolean;
    thresholds?: Thresholds | {
        [glob: string]: Pick<Thresholds, "statements" | "functions" | "branches" | "lines">;
    } & Thresholds;
    watermarks?: {
        branches?: [number, number];
        functions?: [number, number];
        lines?: [number, number];
        statements?: [number, number];
    };
}

Hierarchy (view full)

Properties

all?: boolean

Whether to include all files, including the untested ones into report

Default

false
allowExternal?: boolean

Collect coverage of files outside the project root.

Default

false
clean?: boolean

Clean coverage results before running tests

Default

true
cleanOnRerun?: boolean

Clean coverage report on watch rerun

Default

true
enabled?: boolean

Enables coverage collection. Can be overridden using --coverage CLI option.

Default

false
exclude?: string[]

List of files excluded from coverage as glob patterns

extension?: string | string[]

Extensions for files to be included in coverage

Default

['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte', '.marko']
include?: string[]

List of files included in coverage as glob patterns

Default

['**']
processingConcurrency?: number

Concurrency limit used when processing the coverage results. Defaults to Math.min(20, os.availableParallelism?.() ?? os.cpus().length)

reportOnFailure?: boolean

Generate coverage report even when tests fail.

Default

false
reporter?: Arrayable<(keyof ReportOptions)> | (keyof ReportOptions | [keyof ReportOptions] | ["html", Partial<HtmlOptions>] | ["text", Partial<TextOptions>] | ... 10 more ... | [...])[]

Coverage reporters to use. See istanbul documentation for detailed list of all reporters.

Default

['text', 'html', 'clover', 'json']
reportsDirectory?: string

Directory to write coverage report to

skipFull?: boolean

Do not show files with 100% statement, branch, and function coverage

Default

false
thresholds?: Thresholds | {
    [glob: string]: Pick<Thresholds, "statements" | "functions" | "branches" | "lines">;
} & Thresholds

Configurations for thresholds

Example

{
// Thresholds for all files
functions: 95,
branches: 70,
perFile: true,
autoUpdate: true,

// Thresholds for utilities
'src/utils/**.ts': {
lines: 100,
statements: 95,
}
}
watermarks?: {
    branches?: [number, number];
    functions?: [number, number];
    lines?: [number, number];
    statements?: [number, number];
}

Watermarks for statements, lines, branches and functions.

Default value is [50,80] for each property.

Type declaration

  • Optional branches?: [number, number]
  • Optional functions?: [number, number]
  • Optional lines?: [number, number]
  • Optional statements?: [number, number]

Generated using TypeDoc