Reputation: 2999
installed pnpm add -D vitest
and pnpm add -D @vitest/ui
in my project dir, when i try vitest --ui
, I get this error
vitest : The term 'vitest' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
Upvotes: 7
Views: 6749
Reputation: 545
Run npx vitest
from command line.
The above will work if you have Node installed. npx (node package executor) will automatically search for vitest and execute it or even download it and run it from cache.
Here is a good explanation on how npx works.
Upvotes: 0
Reputation: 141
You should install the package globally using npm or yarn. Don't forget to use sudo
if you are in Mac or Linux.
npm install -g vitest
Upvotes: 8
Reputation: 115
Ensure that your dependencies are installed by running pnpm install
, and then try adding a new script to your package.json
file for running your tests. For example:
"scripts": {
"dev": "vite",
"build": "vite build",
"test": "vitest --ui",
},
Enter the pnpm run test
command in your terminal to run the script.
Upvotes: 2