···4646- Pass `--config` option to CLI, e.g. `vitest --config ./path/to/vitest.config.ts`
4747- Use `process.env.VITEST` or `mode` property on `defineConfig` (will be set to `test` if not overridden) to conditionally apply different configuration in `vite.config.ts`
48484949-To configure `vitest` itself, add `test` property in your Vite config. You'll also need to add a reference to Vitest types using a [triple slash command](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-) at the top of your config file, if you are importing `defineConfig` from `vite` itself.
4949+Vitest supports the same extensions for your configuration file as Vite does: `.js`, `.mjs`, `.cjs`, `.ts`, `.cts`, `.mts`. Vitest does not support `.json` extension.
5050+5151+If you are not using Vite as your build tool, you can configure Vitest using the `test` property in your config file:
50525153```ts
5254import { defineConfig } from 'vitest/config'
···5860})
5961```
60626363+::: tip
6464+Even if you do not use Vite yourself, Vitest relies heavily on it for its transformation pipeline. For that reason, you can also configure any property described in [Vite documentation](https://vitejs.dev/config/).
6565+:::
6666+6767+If you are already using Vite, add `test` property in your Vite config. You'll also need to add a reference to Vitest types using a [triple slash command](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-) at the top of your config file.
6868+6969+```ts
7070+/// <reference types="vitest" />
7171+import { defineConfig } from 'vite'
7272+7373+export default defineConfig({
7474+ test: {
7575+ // ...
7676+ },
7777+})
7878+```
7979+6180See the list of config options in the [Config Reference](../config/)
8181+8282+::: warning
8383+If you decide to have two separate config files for Vite and Vitest, make sure to define the same Vite options in your Vitest config file since it will override your Vite file, not extend it. You can also use `mergeConfig` method from `vite` or `vitest/config` entries to merge Vite config with Vitest config:
8484+8585+:::code-group
8686+```ts [vitest.config.mjs]
8787+import { defineConfig, mergeConfig } from 'vitest/config'
8888+import viteConfig from './vite.config.mjs'
8989+9090+export default mergeConfig(viteConfig, defineConfig({
9191+ test: {
9292+ // ...
9393+ }
9494+}))
9595+```
9696+9797+```ts [vite.config.mjs]
9898+import { defineConfig } from 'vite'
9999+import Vue from '@vitejs/plugin-vue'
100100+101101+export default defineConfig({
102102+ plugins: [Vue()],
103103+})
104104+```
105105+106106+But we recommend to use the same file for both Vite and Vitest instead of creating two separate files.
107107+:::
6210863109## Workspaces Support
64110