I'm not sure which repo is ultimately responsible for this issue, so let me report this here.
I suddenly started running into TypeError: coverageModule.getProvider is not a function when trying to generate coverage with vitest. Let me just skip straight to the investigation results.
Describe the bug
I'm not sure which repo is ultimately responsible for this issue, so let me report this here.
I suddenly started running into
TypeError: coverageModule.getProvider is not a function
when trying to generate coverage with vitest. Let me just skip straight to the investigation results.It seems like
importModule
only considers an import to be ESM if the exported object has a truthy__esModule
property. Reference: https://github.com/antfu/local-pkg/blob/main/index.mjs#L20When I look at the code and dumped the module object during debugging, the module object was found, but the default export doesn't have that property. Reference: https://unpkg.com/browse/@vitest/coverage-c8@0.29.8/dist/index.js
After downgrading
@vitest/coverage-c8
to 0.29.7 it works again.Reproduction
I hope my explanation is enough.
System Info
Used Package Manager
pnpm
Validations