I am using Angular 7 and Jest. When I was running jest with --codecoverage
, all my tests passed but many branches in the constructor were not covered
(similar to: B
I was getting the following error when trying to run Jest in my Angular project.
TypeScript diagnostics (customize using
[jest-config].globals.ts-jest.diagnostics
option): error TS2688: Cannot find type definition file for 'jquery'. error TS2688: Cannot find type definition file for 'jsdom'.
For me I had to add the type definition packages.
yarn add @types/jquery @types/jsdom --dev
After that these errors stopped.