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.

With cached results, changes to type definitions are not detected

See original GitHub issue

Issue :

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 :

  1. Unzip the attached zip file and run yarn and then yarn test (should succeed).
  2. Change the type definition in thing.ts to contain b: number
  3. 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 };

jestCache.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:24 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
angeloocanacommented, Feb 13, 2020

I also have the same issue, it is so annoying, we had to disable the cache to prevent errors. Please fix this issue.

1reaction
ncgreco1440commented, Mar 31, 2020

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.

Read more comments on GitHub >

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

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