Skip to content

cenfun/vitest-monocart-coverage

Repository files navigation

Vitest Monocart Coverage

Generating native V8 coverage report for Vitest with Monocart coverage reports

Install

npm i vitest-monocart-coverage -D

Vitest Config

// 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'

        }
    }
});

See Vitest custom coverage provider

Config file for Coverage Options

  • mcr.config.js
  • mcr.config.cjs
  • mcr.config.mjs
  • mcr.config.json
  • mcr.config.ts

See config example mcr.config.js

// mcr.config.js
export default {
    // logging: 'debug',

    // provider: 'istanbul',

    name: 'My Vitest Coverage Report',

    reports: [
        'console-details',
        'v8'
    ],
    lcov: true,

    outputDir: 'coverage',

    onEnd: (results) => {
        console.log(`coverage report generated: ${results.reportPath}`);
    }
};

See monocart-coverage-reports for more coverage options.

Changelog

About

Monocart coverage reports for Vitest

Resources

License

Stars

Watchers

Forks

Packages

No packages published