-
-
Notifications
You must be signed in to change notification settings - Fork 188
Description
Discussed in #613
Originally posted by DaSchTour June 1, 2023
I have some code that uses mocks and jest functions like mockReturnValue. For example like this
const fooService = spectator.inject(FooService);
fooService.someMethod.mockReturnValue({foo: 'bar'});This worked fine but now suddenly I get typescript errors TS2339: Property 'mockReturnValue' does not exist on type '((key: string | null, location?: string | undefined) => Observable ) & CompatibleSpy'..
It looks like typescript doesn't use the jest typings but the jasmine version.
I'm not sure if that is an issue with my configuration, with a wrong version of jest or maybe caused by TypeScript 5. Did anybody else expect similar issues?
This issue is also present in https://github.com/ngneat/spectator/blob/master/projects/spectator/jest/test/auth.service.spec.ts
So probably there is something wrong with the jest SpyObject typings.
Interesting is, that when opening the file in VSCode or IntelliJ there are errors shown, but the test run correctly without issues.