import { takeCoverage } from 'v8'

243 views Asked by At

Just created a local project using npm init vue@3 using the option vitest. After installing the packages when executing cmd yarn test:unit it throws following errors:

$ yarn test:unit
yarn run v1.22.11
warning package.json: No license field
$ vitest --environment jsdom
(node:19544) UnhandledPromiseRejectionWarning: file:///D:/create-vue-3/vue-project/node_modules/vitest/dist/create-a1bc541a.js:13
import { takeCoverage } from 'v8';
         ^^^^^^^^^^^^
SyntaxError: The requested module 'v8' does not provide an export named 'takeCoverage'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:121:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:166:5)
    at async Loader.import (internal/modules/esm/loader.js:178:24)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19544) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19544) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Done in 0.25s.

see demo: https://stackblitz.com/edit/vitest-dev-vitest-e8wbit?file=vitest.config.ts

0

There are 0 answers