mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-02-01 17:36:51 +00:00
docs: update vite.config.ts to vitest.config.ts (#4259)
This commit is contained in:
parent
1f58a42ec8
commit
de52215223
@ -400,7 +400,7 @@ Define custom aliases when running inside tests. They will be merged with aliase
|
||||
By default, `vitest` does not provide global APIs for explicitness. If you prefer to use the APIs globally like Jest, you can pass the `--globals` option to CLI or add `globals: true` in the config.
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
@ -424,7 +424,7 @@ To get TypeScript working with the global APIs, add `vitest/globals` to the `typ
|
||||
If you are already using [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) in your project, you can also use it directly for auto importing those APIs.
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ Both `v8` and `istanbul` support are optional. By default, `v8` will be used.
|
||||
You can select the coverage tool by setting `test.coverage.provider` to `v8` or `istanbul`:
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
@ -58,7 +58,7 @@ By default, reporter `['text', 'html', 'clover', 'json']` will be used.
|
||||
To configure it, set `test.coverage` options in your config file:
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
@ -75,7 +75,7 @@ export default defineConfig({
|
||||
It's also possible to provide your custom coverage provider by passing `'custom'` in `test.coverage.provider`:
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
@ -44,7 +44,7 @@ Learn more about [Test Filtering](./filtering.md).
|
||||
|
||||
## Running tests concurrently
|
||||
|
||||
Use `.concurrent` in consecutive tests to run them in parallel.
|
||||
Use `.concurrent` in consecutive tests to run them in parallel.
|
||||
|
||||
```ts
|
||||
import { describe, it } from 'vitest'
|
||||
@ -129,7 +129,7 @@ $ npm i -D jsdom
|
||||
After that, change the `environment` option in your config file:
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
@ -34,7 +34,7 @@ if (import.meta.vitest) {
|
||||
Update the `includeSource` config for Vitest to grab the files under `src/`:
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
@ -55,7 +55,7 @@ $ npx vitest
|
||||
For the production build, you will need to set the `define` options in your config file, letting the bundler do the dead code elimination. For example, in Vite
|
||||
|
||||
```ts
|
||||
// vite.config.ts
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user