-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathvitest.unit.config.ts
More file actions
31 lines (30 loc) · 1.33 KB
/
Copy pathvitest.unit.config.ts
File metadata and controls
31 lines (30 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { defineConfig } from 'vitest/config'
import { INTEGRATION_TESTS } from './test/setup/heavy-tests'
/**
* Unit tests in `test/` — no Nuxt build, no browser, no servers. The tests themselves run
* in well under a second; type checking the project they assert against is what the rest of
* the time goes to. `vitest run --typecheck.enabled=false` skips it for a tight loop.
*
* Build-spawning suites live in `vitest.integration.config.ts` (see
* test/setup/heavy-tests.ts for the shared list).
*/
export default defineConfig({
test: {
name: 'unit',
include: ['test/**/*.test.ts'],
exclude: [...INTEGRATION_TESTS, 'test/fixtures/**'],
// `expectTypeOf` compiles to nothing, so a type test only asserts anything when a
// program that contains it is built. Without this the default `**/*.test-d.ts` matched
// no file here and every type assertion in `test/` passed vacuously under `vitest`.
// The root project, not a narrowed one: it extends `.nuxt/tsconfig.json`, and a custom
// `include` drops the generated augmentations with it — `NuxtConfig.i18n` and
// `NuxtConfig.nitro` then stop existing and every fixture config fails to compile.
typecheck: {
enabled: true,
include: ['test/**/*.test.ts'],
tsconfig: './tsconfig.json',
},
testTimeout: 30_000,
pool: 'forks',
},
})