1- import type { CoverageOptions , InlineConfig } from 'vitest' ;
1+ import type { CoverageOptions } from 'vitest' ;
22import { type UserConfig as ViteUserConfig , defineConfig } from 'vitest/config' ;
33import { getSetupFiles } from './vitest-setup-files.js' ;
44import { tsconfigPathAliases } from './vitest-tsconfig-path-aliases.js' ;
@@ -9,8 +9,6 @@ export type E2ETestOptions = {
99 testTimeout ?: number ;
1010} ;
1111
12- export type VitestConfig = ViteUserConfig & { test ?: InlineConfig } ;
13-
1412function getIncludePatterns ( kind : TestKind ) : string [ ] {
1513 switch ( kind ) {
1614 case 'unit' :
@@ -25,10 +23,6 @@ function getIncludePatterns(kind: TestKind): string[] {
2523 }
2624}
2725
28- function getGlobalSetup ( kind : TestKind ) : string [ ] | undefined {
29- return kind === 'e2e' ? undefined : [ '../../global-setup.ts' ] ;
30- }
31-
3226function buildCoverageConfig (
3327 projectKey : string ,
3428 kind : TestKind ,
@@ -37,13 +31,13 @@ function buildCoverageConfig(
3731 return undefined ;
3832 }
3933
40- const defaultExclude = [ 'mocks/**' , '**/types.ts' , 'perf/**' ] ;
34+ const exclude = [ 'mocks/**' , '**/types.ts' , 'perf/**' ] ;
4135 const reportsDirectory = `../../coverage/${ projectKey } /${ kind } -tests` ;
4236
4337 return {
4438 reporter : [ 'text' , 'lcov' ] ,
4539 reportsDirectory,
46- exclude : defaultExclude ,
40+ exclude : exclude ,
4741 } ;
4842}
4943
@@ -54,7 +48,7 @@ export function createVitestConfig(
5448) : ViteUserConfig {
5549 const coverage = buildCoverageConfig ( projectKey , kind ) ;
5650
57- const config : VitestConfig = {
51+ const config : ViteUserConfig = {
5852 cacheDir : `../../node_modules/.vite/${ projectKey } ` ,
5953 test : {
6054 reporters : [ 'basic' ] ,
@@ -67,7 +61,7 @@ export function createVitestConfig(
6761 poolOptions : { threads : { singleThread : true } } ,
6862 environment : 'node' ,
6963 include : getIncludePatterns ( kind ) ,
70- globalSetup : getGlobalSetup ( kind ) ,
64+ globalSetup : [ '../../global-setup.ts' ] ,
7165 setupFiles : [ ...getSetupFiles ( kind ) ] ,
7266 ...( options ?. testTimeout ? { testTimeout : options . testTimeout } : { } ) ,
7367 ...( coverage ? { coverage } : { } ) ,
0 commit comments