Skip to content

Commit

Permalink
fix(vitest): set SSR env only when transformMode is ssr (#4083)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Sep 8, 2023
1 parent 00e8112 commit f8ea716
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 f8ea716

Please sign in to comment.