Skip to content

Commit

Permalink
docs: improve typescript setup explaination, close #1019 (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhang1030 committed Mar 24, 2022
1 parent 329f9ca commit 725bc92
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@

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.

using `defineConfig` from `vite` you should follow this:

```ts
/// <reference types="vitest" />
import { defineConfig } from 'vite'

export default defineConfig({
test: {
// ...
},
})
```

using `defineConfig` from `vitest/config` you should follow this:

```ts
import { defineConfig } from 'vitest/config'

Expand Down Expand Up @@ -206,6 +221,7 @@ Project root
- **Default:** `'default'`

Custom reporters for output. Reporters can be [a Reporter instance](https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/types/reporter.ts) or a string to select built in reporters:

- `'default'` - collapse suites when they pass
- `'verbose'` - keep the full task tree visible
- `'dot'` - show each task as a single dot
Expand Down

0 comments on commit 725bc92

Please sign in to comment.