Jest: Test cases with TypeScript errors report as 'pass' #306
Description
Firstly, thanks to all who contribute to this project -it saved me a lot of headache in getting started with TS + React!
I'm currently writing some smoke tests for React components that have required properties. Currently, I am not passing these required properties to the shallow renderer. I'm expecting these tests to fail with an error such as Property 'title' is missing in type '{ location: {}; }'.
However, the test passes without issue. Is this expected behaviour? Because I kind of expect tests that contain a tsc
error to fail.
I looked through the documentation for ts-jest
and noticed the following option is available: enableTsDiagnostics
. Setting this value to true
will "enable Syntactic & Semantic TypeScript error reporting". However, due to the supported keys whitelist, I cannot enable this option without ejecting.
Personally, I think this option should be configurable without ejecting. I'm surprised this setting isn't enabled by default. My reasoning is that we shouldn't lose out on one of the biggest advantages of TypeScript (type checking) in our tests. Am I alone in thinking this? Is there a reason this option isn't enabled by default, or configurable at all?