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

V8 import error inside vitest library #670

Closed
6 tasks done
KaloyanYosifov opened this issue Feb 3, 2022 · 3 comments · Fixed by #672
Closed
6 tasks done

V8 import error inside vitest library #670

KaloyanYosifov opened this issue Feb 3, 2022 · 3 comments · Fixed by #672

Comments

@KaloyanYosifov
Copy link

Describe the bug

I receive an import error locally on my machine and on stackblitz. I am using the latest version of vitest 0.2.6

Here is the error:

(node:18) UnhandledPromiseRejectionWarning: file:///home/projects/vitejs-vite-tmqc9d/node_modules/vitest/dist/create-a1bc541a.js:13
import { takeCoverage } from 'v8';
         ^^^^^^^^^^^^
SyntaxError: The requested module 'v8' does not provide an export named 'takeCoverage'

Reproduction

https://stackblitz.com/edit/vitejs-vite-tmqc9d

Run in terminal npm install and then npm run test

System Info

System:
    OS: macOS 11.6
    CPU: (8) x64 Apple M1
    Memory: 22.05 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.5 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.14 - /usr/local/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 98.0.4758.80
    Edge: 97.0.1072.76
    Safari: 15.0
    Safari Technology Preview: 15.4

Used Package Manager

yarn

Validations

@KaloyanYosifov KaloyanYosifov changed the title V8 import error inside library V8 import error inside vitest library Feb 3, 2022
@Demivan
Copy link
Member

Demivan commented Feb 3, 2022

@KaloyanYosifov As a workaround update node to at least 14.18.0

@Demivan
Copy link
Member

Demivan commented Feb 3, 2022

@antfu takeCoverage was added in node 14.18.0. Should we up the required node version?
Without takeCoverage there is no way to flush coverage to disk and have a complete coverage.

@FossPrime
Copy link

Alternative workaround, downgrade to 0.2.5. It will run in Node 14.16.0 / Stackblitz

@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants