Generating native V8 coverage report for Vitest with Monocart coverage reports
npm i vitest-monocart-coverage -D
// vitest.config.js
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
include: ['test/*.test.js'],
coverage: {
enabled: true,
include: ['src/**'],
provider: 'custom',
customProviderModule: 'vitest-monocart-coverage',
// or a config path for coverage options
// coverageReportOptions: "mcr.config.js"
coverageReportOptions: {
// https://github.com/cenfun/monocart-coverage-reports
// logging: 'debug',
name: 'My Vitest Coverage Report',
reports: [
'console-details',
'v8'
],
lcov: true,
outputDir: 'coverage'
}
}
}
});
- NOTE:
coverageReportOptions
is unknown property of Vitestcoverage
when using Typescript. Please move thecoverageReportOptions
to default config filemcr.config.js
- See Vitest Custom Coverage Provider
- 1.1.1
- (Breaking) rename customProviderOptions to coverageReportOptions, and supports string as a config path
- supports istanbul data