-
Notifications
You must be signed in to change notification settings - Fork 460
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
With cached results, changes to type definitions are not detected between packages #2707
Comments
I would say yes, it’s quite a change, generally speaking is: moving type check to one phase earlier in transform process. The current design is: collecting all dependencies to construct cache keys and let Jest handle when a file needs to be rechecked. What I have in mind for a design change is: instead of letting Jest handle, we would always do type check before creating a Jest cache key (ofc only do this when user uses cache). Following this approach will technically solve issues but probably require a smart way of caching for |
Is there any ETA on when this bug might be fixed? Our team keeps experiencing it and it's quite costly for us. |
For the record, I ended up working around this. I changed our build scripts to compile our test code with the TS compiler, not just the product code. We still use ts-jest to run the tests but the cache bug won't affect us because compilation errors are caught by the TS compiler. |
🐛 Bug Report
When a typescript package is compiled with type info, changes to the type info may be missed by ts-jest when the package is referenced from another package. Similar to #1747 but not identical.
To Reproduce
Steps to reproduce the behavior:
Unzip the attached zip file and follow the README.txt, which is copied inline here:
In the examplePackage folder, run:
yarn
yarn build
yarn link
In the consumerWithTest folder, run:
yarn
yarn link @example/package
yarn test
So far so good (the jestCache folder is created).
Now edit index.ts to uncomment
b: number;
and in the examplePackage folder, run:yarn build
In the consumerWithTest folder, run:
yarn test
This should fail due to the change in type definition in index.ts, but passes.
Running yarn test --no-cache correctly identifies the problem.
jestCacheIssue.zip
Expected behavior
Type info should be respected without clearing the cache
Link to repo (highly encouraged)
Debug log:
envinfo
The text was updated successfully, but these errors were encountered: