With cached results, changes to type definitions are not detected
See original GitHub issueIssue :
Given a type declaration in core code, and a reference to that type definition in jest code, type-safety is not always enforced.
Expected behavior :
Changes to type definitions should be detected (failing to compile where appropriate).
Minimal repo :
- Unzip the attached zip file and run yarn and then yarn test (should succeed).
- Change the type definition in thing.ts to contain
b: number
- Run yarn test again. Due to the cache, it succeeds and should not. It will (correctly) fail if you remove the cache folder “jestCache”
thing.ts contains:
export type Thing = {
a: number;
// b: number;
};
thing.test.ts contains:
export const thing: Thing = { a: 1 };
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:24 (1 by maintainers)
Top Results From Across the Web
Configuring the Apollo Client cache - Apollo GraphQL Docs
This helps you detect changes to a query's result. ... To accomplish this, you define a TypePolicy for each type you want to...
Read more >Using cached query results | BigQuery - Google Cloud
BigQuery writes all query results to a table. The table is either explicitly identified by the user (a destination table), or it is...
Read more >Caching issues - Streamlit Docs
Streamlit raises this error whenever it encounters a type it doesn't know how to hash. This could be either when hashing the inputs...
Read more >Debugging and diagnosing cache misses - Gradle User Manual
If the results are not satisfactory, you can think about restructuring your project to reduce dependencies between different tasks. Evaluating cache performance ...
Read more >Enable caching for incremental enrichment in Azure Cognitive ...
The portal does not currently provide an option for caching enrichment. ... add the "cache" property in the indexer definition payload when ...
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
I also have the same issue, it is so annoying, we had to disable the cache to prevent errors. Please fix this issue.
So far it seems to do the job. I made a new test which attempts to dereference an invalid property on a class. Once the test suite runs, I see a failure as expected. Upon making a change to the source code and waiting for the test suite to rerun ts-jest now properly sees the newly create property in the class and the test passes as expected.
I ran jest with --watch and --watchAll same results.