jest mock return new rieu 2023-11-15 39 阅读1分钟 jest.mock(moduleName,moduleFactory) moduleFactory must return a high class function to be able to new this works: jest.mock('moduleName', () => { return { Session: jest.fn().mockImplementation(() => { return mockSession }), } })