From 2657ce562af53c9a702ae4173ddda5b9849c077e Mon Sep 17 00:00:00 2001 From: yoho Date: Mon, 5 Dec 2022 22:29:40 +0800 Subject: [PATCH] docs: clarify installing globally (#2397) * docs: install global * chore: update Co-authored-by: The Jared Wilcurt * docs: npx help * docs: update * fix: error Co-authored-by: The Jared Wilcurt --- docs/guide/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/guide/index.md b/docs/guide/index.md index 32911807e783..dd11c7edbf83 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -33,6 +33,10 @@ pnpm add -D vitest Vitest requires Vite >=v3.0.0 and Node >=v14 ::: +It is recommended that you install a copy of `vitest` in your `package.json`, using one of the methods listed above. However, if you would prefer to run `vitest` directly, you can use `npx vitest` (the `npx` command comes with npm and Node.js). + +The `npx` command will executes command either from a local `node_modules/.bin` installing any packages needed in order for command to run. By default, npx will check whether command exists in $PATH, or in the local project binaries, and execute that. If command is not found, it will be installed prior to execution. + ## Configuring Vitest One of the main advantages of Vitest is its unified configuration with Vite. If present, `vitest` will read your root `vite.config.ts` to match with the plugins and setup as your Vite app. For example, your Vite [resolve.alias](https://vitejs.dev/config/shared-options.html#resolve-alias) and [plugins](https://vitejs.dev/guide/using-plugins.html) configuration will work out-of-the-box. If you want a different configuration during testing, you can: