Tests pass even when there are TypeScript errors
See original GitHub issueAccording to https://github.com/facebook/create-react-app/issues/5626, there’s a limitation in how Create React App sets out jest, which means type checking isn’t being done properly on test files. That means tests could still be passing even if they should break because of TS error.
The workaround seems to be adding tsc
before running the tests so the test files goes through the TS type checker and only run the tests if succeeds. Will have to fix some broken test files as a result of this.
Also, linting also don’t seem to be applied to test files which would normally fail the app build, so we may need to add a similar workaround to the above by running the eslint
command against files ending in test.ts[x]*
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Jest: Test cases with TypeScript errors report as 'pass' #306
I'm currently writing some smoke tests for React components that have required properties. Currently, I am not passing these required properties ...
Read more >Linting errors in react testing - typescript - Stack Overflow
To fix that, you must type useStateWithLocalStorage correctly. It seems you expect to able to pass complex objects to useStateWithLocalStorage ...
Read more >Testing errors with Jest - DEV Community
I'm continuing with Jest and typescript, we already know how to expect and assert variables and objects in our code, next step is...
Read more >Error Messages | Cypress Documentation
Test File Errors No tests found This message means that Cypress was unable to find tests in the specified file. You'll likely get...
Read more >Control flow and error handling - JavaScript - MDN Web Docs
JavaScript supports a compact set of statements, specifically control ... the statements in the finally block execute even if no catch block ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi everyone! I would love to pick up this issue (and join the development team if I may 😃 ).
Yup! Looks like there aren’t too many then 😌