-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jest with TypeScript do not report any type errors #2168
Comments
How are type errors thrown by the TypeScript compiler? If it throws a type error on a file, Jest should catch that and show it inline. If the type error is thrown in a file that hasn't changed, Jest will not compile that particular file because it has a transform cache based on when files change. If that's the case, I'm afraid there is nothing we can do except for you to always run with the (slow) |
Hello @cpojer One should gather type errors by himself inside preprocess script. Currently the function which is used in example do not collect any diagnostics. And even if it would there would be no type errors within it. Note Also in case it throws there is no source maps, so errors shows completely random line numbers. At least for source maps there is solution. By writing this I am now thinking that it has nothing to do with Jest. But still maybe it would be nice to use ts-jest in the example instead of providing preprocessor which is kind of broken in so many ways. And of course it would be nice to be explicitly notified about problems with type errors in TypeScript, so one could see the trade-offs before putting his time in technology adoption. |
Feel free to send a PR to change the TypeScript example to use |
@cpojer actually if Jest would provide ability to use stuff like |
That would be incredibly slow as we'd have to recompile everything on every run. Jest caches transform results. |
BTW, |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hello, here is my bug report.
Currently when you use TypeScript in a way shown in example you will not be reported if there are type errors in tests.
Reproduce:
To verify that there is actual type error:
I expect type errors to be reported while running tests. Preferably well-formatted.
The text was updated successfully, but these errors were encountered: