Skip to content

Commit a083371

Browse files
committed
Fix issues related to stubbing envs in createAsyncThunk.test.ts
1 parent 4beb3f6 commit a083371

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,19 +492,17 @@ describe('createAsyncThunk with abortController', () => {
492492
describe('behavior with missing AbortController', () => {
493493
let keepAbortController: (typeof window)['AbortController']
494494
let freshlyLoadedModule: typeof import('../createAsyncThunk')
495-
let nodeEnv: string
496495

497496
beforeEach(async () => {
498497
keepAbortController = window.AbortController
499498
delete (window as any).AbortController
500499
vi.resetModules()
501500
freshlyLoadedModule = await import('../createAsyncThunk')
502-
nodeEnv = process.env.NODE_ENV!
503-
;(process.env as any).NODE_ENV = 'development'
501+
vi.stubEnv('NODE_ENV', 'development')
504502
})
505503

506504
afterEach(() => {
507-
;(process.env as any).NODE_ENV = nodeEnv
505+
vi.unstubAllEnvs()
508506
window.AbortController = keepAbortController
509507
vi.resetModules()
510508
})

0 commit comments

Comments
 (0)