Skip to content

Commit

Permalink
fix(coverage): throw error if fail to load built-in provider (#3217)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Apr 21, 2023
1 parent cbfd2c5 commit 0a2875e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vitest/src/integrations/coverage.ts
Original file line number Diff line number Diff line change
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

0 comments on commit 0a2875e

Please sign in to comment.