I'm trying to test my typescript code using Jest and ts-auto-mock
package.
But when I pass an interface to createMock
function using a generic parameter, it raises a weird error on a weird place!
For example when I'm running this test:
describe('Channel Service', () => {
// let mok: MockedServices;
// const mokChannels = createMockList<Channel>(10);
// const mokChannelsDto = createMock<GetChannelsDto>();
function mockIt<U extends object>() {
return createMock<U>();
}
const testMok = mockIt<User>();
console.log(testMok);
console.log('Something lo be logged!!!');
});
It generates this error on a wrong line!:
ReferenceError: t is not defined
This is the full error message: