Goal is to find out and provide examples of how to mock imported classes, functions and objects in CRA TypeScript tests with good type support of said mocks.
This project was bootstrapped with Create React App. It is plain TS CRA ATM. Not ejected.
VSCode is used for coding. It contains Debug Jest test
launch configuration that can be executed against current test file in order to debug it. Breakpoints supported as well.
Can be found in jest-mocks
Can be found in mockito-mocks
- Line numbers of TypeScript tests in Jest are off. Bug.
- Debugging from vscode launched with --coverage because of CRA limitations.