Skip to content

Commit

Permalink
fix(vitest): set SSR env only when transformMode is ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Sep 7, 2023
1 parent 8b46ee8 commit 3e00341
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/vitest/src/node/plugins/index.ts
Expand Up @@ -140,7 +140,6 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t
// so we are making them truthy
process.env.PROD ??= PROD ? '1' : ''
process.env.DEV ??= DEV ? '1' : ''
process.env.SSR ??= '1'

for (const name in envs)
process.env[name] ??= envs[name]
Expand Down
4 changes: 4 additions & 0 deletions packages/vitest/src/runtime/setup.node.ts
Expand Up @@ -37,6 +37,10 @@ export async function setupGlobalEnv(config: ResolvedConfig, { environment }: Re
_require.extensions['.scss'] = () => ({})
_require.extensions['.sass'] = () => ({})
_require.extensions['.less'] = () => ({})
process.env.SSR = ''
}
else {
process.env.SSR = '1'
}

installSourcemapsSupport({
Expand Down

0 comments on commit 3e00341

Please sign in to comment.