@@ -2,10 +2,11 @@ import * as DevTools from '@internal/devtoolsExtension'
22import type { StoreEnhancer } from '@reduxjs/toolkit'
33import { Tuple } from '@reduxjs/toolkit'
44import type * as Redux from 'redux'
5+ import type { MockInstance } from 'vitest'
56import { vi } from 'vitest'
67
7- vi . doMock ( 'redux' , async ( ) => {
8- const redux : any = await vi . importActual ( 'redux' )
8+ vi . doMock ( 'redux' , async ( importOriginal ) => {
9+ const redux = await importOriginal < typeof import ( 'redux' ) > ( )
910
1011 vi . spyOn ( redux , 'applyMiddleware' )
1112 vi . spyOn ( redux , 'combineReducers' )
@@ -15,10 +16,19 @@ vi.doMock('redux', async () => {
1516 return redux
1617} )
1718
19+ declare global {
20+ interface Window {
21+ __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : MockInstance <
22+ Parameters < typeof DevTools . composeWithDevTools > ,
23+ ReturnType < typeof DevTools . composeWithDevTools >
24+ >
25+ }
26+ }
27+
1828describe ( 'configureStore' , async ( ) => {
1929 const composeWithDevToolsSpy = vi . spyOn ( DevTools , 'composeWithDevTools' )
2030
21- ; ( window as any ) . __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = composeWithDevToolsSpy
31+ window . __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = composeWithDevToolsSpy
2232
2333 const redux = await import ( 'redux' )
2434
0 commit comments