TypeScript doesn't recognize my jest mock module
问题 Suppose I have an index.ts that will import Database.ts and run some queries. To test this index.ts file, I want to mock the Database.ts because I don't want to connect to any real database. This is my index.ts : import { connect } from './Database' export async function runSomeQuery() { const connection = await connect() const result = await connection.query('SOME QUERY') return result } and here is the mock of database ( __mocks__/Database.ts ) const mockConnection = { query: jest.fn() }