Skip to content

Commit a3c06b0

Browse files
committed
fix: check config.server.hmr instead of env to detect testing mode
1 parent a651c85 commit a3c06b0

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

packages/plugin-react/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
128128
skipFastRefresh =
129129
isProduction ||
130130
config.command === 'build' ||
131-
(!!process.env.TEST && !process.env.VITE_TEST_HMR)
131+
config.server.hmr === false
132132

133133
if ('jsxPure' in opts) {
134134
config.logger.warnOnce(

playground/test-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export async function untilUpdated(
9595
runInBuild = false,
9696
): Promise<void> {
9797
if (isBuild && !runInBuild) return
98-
const maxTries = process.env.CI ? 200 : 50
98+
const maxTries = process.env.CI ? 100 : 50
9999
for (let tries = 0; tries < maxTries; tries++) {
100100
const actual = (await poll()) ?? ''
101101
if (actual.indexOf(expected) > -1 || tries === maxTries - 1) {

playground/vitest.config.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { resolve } from 'node:path'
22
import { defineConfig } from 'vitest/config'
33

4-
const timeout = process.env.CI ? 50000 : 30000
4+
const timeout = process.env.CI ? 20_000 : 10_000
55

66
export default defineConfig({
77
resolve: {

playground/vitestGlobalSetup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup')
99
let browserServer: BrowserServer | undefined
1010

1111
export async function setup(): Promise<void> {
12-
process.env.VITE_TEST_HMR = 'true' // To force HMR transformation in test environment
1312
process.env.NODE_ENV = process.env.VITE_TEST_BUILD
1413
? 'production'
1514
: 'development'

0 commit comments

Comments
 (0)