-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
99 lines (98 loc) · 3.33 KB
/
vitest.config.ts
File metadata and controls
99 lines (98 loc) · 3.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { resolve } from 'pathe'
import { defineVitestProject } from '@nuxt/test-utils/config'
import { configDefaults, coverageConfigDefaults, defaultExclude, defineConfig } from 'vitest/config'
import { isCI, isWindows } from 'std-env'
import { getV8Flags } from '@codspeed/core'
import codspeedPlugin from '@codspeed/vitest-plugin'
export default defineConfig({
test: {
coverage: {
exclude: [...coverageConfigDefaults.exclude, 'playground', '**/test/', 'scripts'],
},
poolOptions: isCI ? { forks: { execArgv: getV8Flags() } } : undefined,
projects: [
{
plugins: isCI ? [codspeedPlugin()] : [],
test: {
name: 'benchmark',
pool: isCI ? 'forks' : undefined,
include: [],
benchmark: {
include: ['**/*.bench.ts'],
},
},
},
{
test: {
name: 'fixtures',
include: ['test/*.test.ts'],
setupFiles: ['./test/setup-env.ts'],
testTimeout: isWindows ? 60000 : 10000,
// Excluded plugin because it should throw an error when accidentally loaded via Nuxt
exclude: [...configDefaults.exclude, 'test/e2e/**', 'e2e/**', 'nuxt/**', '**/test.ts', '**/this-should-not-load.spec.js'],
benchmark: { include: [] },
},
},
{
resolve: {
alias: {
'#build/nuxt.config.mjs': resolve('./test/mocks/nuxt-config'),
'#build/router.options': resolve('./test/mocks/router-options'),
'#internal/nuxt/paths': resolve('./test/mocks/paths'),
'#build/app.config.mjs': resolve('./test/mocks/app-config'),
'#app': resolve('./packages/nuxt/dist/app'),
},
},
test: {
name: 'unit',
benchmark: { include: [] },
setupFiles: ['./test/setup-env.ts'],
include: ['packages/**/*.test.ts'],
testTimeout: isWindows ? 60000 : 10000,
// Excluded plugin because it should throw an error when accidentally loaded via Nuxt
exclude: [...configDefaults.exclude, 'test/e2e/**', 'e2e/**', 'nuxt/**', '**/test.ts', '**/this-should-not-load.spec.js'],
},
},
await defineVitestProject({
test: {
name: 'nuxt-universal',
dir: './test/nuxt/universal',
environment: 'nuxt',
environmentOptions: {
nuxt: {
overrides: { pages: false },
},
},
},
}),
await defineVitestProject({
test: {
name: 'nuxt',
dir: './test/nuxt',
exclude: [...defaultExclude, '**/universal/**'],
environment: 'nuxt',
setupFiles: ['./test/setup-runtime.ts'],
environmentOptions: {
nuxt: {
overrides: {
pages: true,
routeRules: {
'/specific-prerendered': { prerender: true },
'/pre/test': { redirect: '/' },
'/pre/**': { prerender: true },
},
experimental: {
appManifest: process.env.TEST_MANIFEST !== 'manifest-off',
alwaysRunFetchOnKeyChange: true,
},
imports: {
polyfills: false,
},
},
},
},
},
}),
],
},
})