question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests pass even when there are TypeScript errors

See original GitHub issue

According 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:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
thdkcommented, Apr 10, 2021

Hi everyone! I would love to pick up this issue (and join the development team if I may 😃 ).

0reactions
darrenvongcommented, Apr 10, 2021

Do you mean these two lint warnings?

image

Yup! Looks like there aren’t too many then 😌

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found