Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

antonovicha/cra-ts-test-mock-examples

Repository files navigation

Examples of how to mock import-ed classes in TS CRA

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.

Intro

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.

Jest examples

Can be found in jest-mocks

ts-mockito examples

Can be found in mockito-mocks

Known issues

  • Line numbers of TypeScript tests in Jest are off. Bug.
  • Debugging from vscode launched with --coverage because of CRA limitations.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published