Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(coverage): throw error if fail to load built-in provider #3217

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/vitest/src/integrations/coverage.ts
Expand Up @@ -17,6 +17,10 @@ async function resolveCoverageProviderModule(options: CoverageOptions | undefine

if (provider === 'c8' || provider === 'istanbul') {
const { default: coverageModule } = await loader.executeId(CoverageProviderMap[provider])

if (!coverageModule)
throw new Error(`Failed to load ${CoverageProviderMap[provider]}. Default export is missing.`)

return coverageModule
}

Expand Down