Skip to content

Commit

Permalink
feat: support npm setup files (#1312)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmkx committed May 17, 2022
1 parent 0ec0fc4 commit 7b56822
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vitest/src/node/config.ts
@@ -1,4 +1,5 @@
import { resolve } from 'pathe'
import { resolveModule } from 'local-pkg'
import { normalize, resolve } from 'pathe'
import c from 'picocolors'
import type { ResolvedConfig as ResolvedViteConfig } from 'vite'

Expand Down Expand Up @@ -122,7 +123,7 @@ export function resolveConfig(
if (process.env.VITEST_MIN_THREADS)
resolved.minThreads = parseInt(process.env.VITEST_MIN_THREADS)

resolved.setupFiles = toArray(resolved.setupFiles || []).map(file => resolve(resolved.root, file))
resolved.setupFiles = toArray(resolved.setupFiles || []).map(file => normalize(resolveModule(file, { paths: [resolved.root] })!))

// the server has been created, we don't need to override vite.server options
resolved.api = resolveApiConfig(options)
Expand Down

0 comments on commit 7b56822

Please sign in to comment.