@@ -38,9 +38,7 @@ async function restoreElectronFunctionality(apiName: string, funcName: string, b
3838export async function createMock ( apiName : string , funcName : string , browserContext ?: WebdriverIO . Browser ) {
3939 log . debug ( `[${ apiName } .${ funcName } ] createMock called - starting mock creation` ) ;
4040 // biome-ignore lint/complexity/useArrowFunction: Vitest v4 requires vi.fn() to use function declarations, not arrow functions
41- const outerMock = vitestFn ( function ( ) {
42- // Default empty implementation
43- } ) ;
41+ const outerMock = vitestFn ( ) ;
4442 const outerMockImplementation = outerMock . mockImplementation ;
4543 const outerMockImplementationOnce = outerMock . mockImplementationOnce ;
4644 const outerMockClear = outerMock . mockClear ;
@@ -102,15 +100,7 @@ export async function createMock(apiName: string, funcName: string, browserConte
102100 async ( electron , apiName , funcName ) => {
103101 const electronApi = electron [ apiName as keyof typeof electron ] ;
104102 const spy = await import ( '@vitest/spy' ) ;
105- // Store original function before mocking
106- const originalFn = electronApi [ funcName as keyof typeof electronApi ] as unknown as Function ;
107- const mockFn = spy . fn ( function ( this : unknown , ...args : unknown [ ] ) {
108- // Default implementation calls the original function
109- if ( typeof originalFn === 'function' ) {
110- return originalFn . apply ( this , args ) ;
111- }
112- return undefined ;
113- } ) ;
103+ const mockFn = spy . fn ( ) ;
114104
115105 // replace target API with mock
116106 electronApi [ funcName as keyof typeof electronApi ] = mockFn as ElectronApiFn ;
0 commit comments