(filePathSubstr: string, mockValue: string)
| 10 | * and otherwise returns the original content. |
| 11 | */ |
| 12 | export const mockReadFileSync = (filePathSubstr: string, mockValue: string) => { |
| 13 | return jest.spyOn(fs, 'readFileSync').mockImplementation((...args) => { |
| 14 | const path = args[0].toString(); |
| 15 | if (path.includes(filePathSubstr)) { |
| 16 | return mockValue; |
| 17 | } |
| 18 | return originalFs(...args); |
| 19 | }); |
| 20 | }; |
no outgoing calls
no test coverage detected