Skip to content

Commit 4a5972b

Browse files
committed
Fix issues related to stubbing envs in getDefaultMiddleware.test.ts
1 parent f7269a4 commit 4a5972b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/toolkit/src/tests/getDefaultMiddleware.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ import { buildGetDefaultMiddleware } from '@internal/getDefaultMiddleware'
1414
const getDefaultMiddleware = buildGetDefaultMiddleware()
1515

1616
describe('getDefaultMiddleware', () => {
17-
const ORIGINAL_NODE_ENV = process.env.NODE_ENV
18-
1917
afterEach(() => {
20-
process.env.NODE_ENV = ORIGINAL_NODE_ENV
18+
vi.unstubAllEnvs()
2119
})
2220

2321
describe('Production behavior', () => {
@@ -26,7 +24,8 @@ describe('getDefaultMiddleware', () => {
2624
})
2725

2826
it('returns an array with only redux-thunk in production', async () => {
29-
process.env.NODE_ENV = 'production'
27+
vi.stubEnv('NODE_ENV', 'production')
28+
3029
const { thunk } = await import('redux-thunk')
3130
const { buildGetDefaultMiddleware } = await import(
3231
'@internal/getDefaultMiddleware'

0 commit comments

Comments
 (0)