diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index 5004a8c87d22..61dc028476f4 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -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] diff --git a/packages/vitest/src/runtime/setup.node.ts b/packages/vitest/src/runtime/setup.node.ts index 2e1a1aa3ee89..e1f1bc1f1d25 100644 --- a/packages/vitest/src/runtime/setup.node.ts +++ b/packages/vitest/src/runtime/setup.node.ts @@ -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({