2024-02-05 11:24:39 +00:00
|
|
|
import { resolve } from 'pathe'
|
2023-12-21 11:09:15 +00:00
|
|
|
import { configDefaults, coverageConfigDefaults, defineConfig } from 'vitest/config'
|
2022-04-12 18:36:39 +00:00
|
|
|
import { isWindows } from 'std-env'
|
2023-12-20 22:18:31 +00:00
|
|
|
import codspeedPlugin from '@codspeed/vitest-plugin'
|
2022-02-16 18:07:33 +00:00
|
|
|
|
|
|
|
export default defineConfig({
|
2023-12-20 22:18:31 +00:00
|
|
|
plugins: [codspeedPlugin()],
|
2022-07-21 10:44:33 +00:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-10-18 12:43:42 +00:00
|
|
|
'#build/nuxt.config.mjs': resolve('./test/mocks/nuxt-config'),
|
2023-11-14 12:44:39 +00:00
|
|
|
'#build/paths.mjs': resolve('./test/mocks/paths'),
|
|
|
|
'#build/app.config.mjs': resolve('./test/mocks/app-config'),
|
|
|
|
'#app': resolve('./packages/nuxt/dist/app')
|
2022-07-21 10:44:33 +00:00
|
|
|
}
|
2022-03-17 22:17:59 +00:00
|
|
|
},
|
2022-04-07 19:15:30 +00:00
|
|
|
test: {
|
2023-06-27 09:38:40 +00:00
|
|
|
globalSetup: './test/setup.ts',
|
2023-09-19 21:26:15 +00:00
|
|
|
setupFiles: ['./test/setup-env.ts'],
|
2023-12-21 11:09:15 +00:00
|
|
|
coverage: {
|
|
|
|
exclude: [...coverageConfigDefaults.exclude, 'packages/nuxt/src/app', 'playground', '**/test/', 'scripts', 'vitest.nuxt.config.ts']
|
|
|
|
},
|
2023-01-20 16:23:16 +00:00
|
|
|
testTimeout: isWindows ? 60000 : 10000,
|
|
|
|
// Excluded plugin because it should throw an error when accidentally loaded via Nuxt
|
2023-12-11 18:20:11 +00:00
|
|
|
exclude: [...configDefaults.exclude, 'nuxt/**', '**/test.ts', '**/this-should-not-load.spec.js'],
|
|
|
|
poolOptions: {
|
|
|
|
threads: {
|
|
|
|
maxThreads: process.env.TEST_ENV === 'dev' ? 1 : undefined,
|
|
|
|
minThreads: process.env.TEST_ENV === 'dev' ? 1 : undefined
|
|
|
|
}
|
|
|
|
}
|
2022-02-16 18:07:33 +00:00
|
|
|
}
|
|
|
|
})
|