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

importModule does not work with @vitest/coverage-c8@0.29.8 #7

Closed
5 tasks done
dteoh opened this issue Mar 31, 2023 · 0 comments
Closed
5 tasks done

importModule does not work with @vitest/coverage-c8@0.29.8 #7

dteoh opened this issue Mar 31, 2023 · 0 comments

Comments

@dteoh
Copy link

dteoh commented Mar 31, 2023

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#L20

When 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

System:
    OS: macOS 12.6.2
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 20.13 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.asdf/installs/nodejs/18.15.0/bin/node
    npm: 9.5.0 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 111.0.5563.146
    Firefox: 111.0.1
    Safari: 16.3
    Safari Technology Preview: 16.4

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant