@@ -62,7 +62,7 @@ describe("Settings Migration", () => {
6262 const mockRename = vitest . mocked ( fs . rename ) . mockResolvedValue ( undefined )
6363
6464 // Mock file existence checks - only return true for paths we want to exist
65- vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async ( path : string ) => {
65+ vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async function ( path : string ) {
6666 if ( path === mockSettingsDir ) return true
6767 if ( path === legacyClineCustomModesPath ) return true
6868 return false // All other paths don't exist, including destination files
@@ -83,7 +83,7 @@ describe("Settings Migration", () => {
8383 const mockRename = vitest . mocked ( fs . rename ) . mockResolvedValue ( undefined )
8484
8585 // Ensure the other files don't interfere with this test
86- vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async ( path : string ) => {
86+ vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async function ( path : string ) {
8787 if ( path === mockSettingsDir ) return true
8888 if ( path === legacyMcpSettingsPath ) return true
8989 if ( path === legacyClineCustomModesPath ) return false // Ensure this file doesn't exist
@@ -106,7 +106,7 @@ describe("Settings Migration", () => {
106106 const mockRename = vitest . mocked ( fs . rename ) . mockResolvedValue ( undefined )
107107
108108 // Mock file existence checks - both source and destination exist
109- vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async ( path : string ) => {
109+ vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async function ( path : string ) {
110110 if ( path === mockSettingsDir ) return true
111111 if ( path === legacyClineCustomModesPath ) return true
112112 if ( path === legacyCustomModesJson ) return true // Destination already exists
@@ -147,15 +147,15 @@ describe("Settings Migration", () => {
147147 const mockUnlink = vitest . mocked ( fs . unlink ) . mockResolvedValue ( undefined )
148148
149149 // Mock file read to return JSON content
150- vitest . mocked ( fs . readFile ) . mockImplementation ( async ( path : any ) => {
150+ vitest . mocked ( fs . readFile ) . mockImplementation ( async function ( path : any ) {
151151 if ( path === legacyCustomModesJson ) {
152152 return testJsonContent
153153 }
154154 throw new Error ( "File not found: " + path )
155155 } )
156156
157157 // Isolate this test by making sure only the specific JSON file exists
158- vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async ( path : string ) => {
158+ vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async function ( path : string ) {
159159 if ( path === mockSettingsDir ) return true
160160 if ( path === legacyCustomModesJson ) return true
161161 if ( path === legacyClineCustomModesPath ) return false
@@ -185,15 +185,15 @@ describe("Settings Migration", () => {
185185 const mockUnlink = vitest . mocked ( fs . unlink ) . mockResolvedValue ( undefined )
186186
187187 // Mock file read to return corrupt JSON
188- vitest . mocked ( fs . readFile ) . mockImplementation ( async ( path : any ) => {
188+ vitest . mocked ( fs . readFile ) . mockImplementation ( async function ( path : any ) {
189189 if ( path === legacyCustomModesJson ) {
190190 return "{ invalid json content" // This will cause an error when parsed
191191 }
192192 throw new Error ( "File not found: " + path )
193193 } )
194194
195195 // Isolate this test
196- vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async ( path : string ) => {
196+ vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async function ( path : string ) {
197197 if ( path === mockSettingsDir ) return true
198198 if ( path === legacyCustomModesJson ) return true
199199 if ( path === legacyClineCustomModesPath ) return false
@@ -222,15 +222,15 @@ describe("Settings Migration", () => {
222222 const mockUnlink = vitest . mocked ( fs . unlink ) . mockResolvedValue ( undefined )
223223
224224 // Mock file read
225- vitest . mocked ( fs . readFile ) . mockImplementation ( async ( path : any ) => {
225+ vitest . mocked ( fs . readFile ) . mockImplementation ( async function ( path : any ) {
226226 if ( path === legacyCustomModesJson ) {
227227 return JSON . stringify ( { customModes : [ ] } )
228228 }
229229 throw new Error ( "File not found: " + path )
230230 } )
231231
232232 // Mock file existence checks - both source and yaml destination exist
233- vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async ( path : string ) => {
233+ vitest . mocked ( fileExistsAtPath ) . mockImplementation ( async function ( path : string ) {
234234 if ( path === mockSettingsDir ) return true
235235 if ( path === legacyCustomModesJson ) return true
236236 if ( path === newCustomModesYaml ) return true // YAML already exists
0 commit comments