-
Notifications
You must be signed in to change notification settings - Fork 451
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
Curious behavior with --no-cache option and ts imports from node_modules #805
Comments
Hi @DorianGrey thanks for reporting the issue. The "minimal repo" is just that often people cannot give a link to their repo as it is private. So it's fine with your repo as soon as we can reproduce the issue with a command line that does not run 1000 tests ;-) Can you do this and give the result please:
|
HI @huafu , |
hmmmm. that's definitely a bug! thanks! |
I think I've just stumbled upon this issue myself. I have a non-test file in my
The offending line in that test file: import { COUNTER } from './example-aggregate'; |
@alfaproject Ran into this error as well. We're importing modules from another project which did not have any globals: {
'ts-jest': {
isolatedModules: true
},
}, |
I would prefer to have type checking but in my case, I'm only using local files (as you can see in the import) and all my TSConfig settings enable declarations. ): |
I just ran into this same problem and did some debugging. The reason for this is because Typescript is specifically ignoring node_modules with the getEmitOutput() API that ts-jest is using when type checking is enabled. microsoft/TypeScript#11946 So if you still want full type checking, the solution is to specifically include the node_modules files in the |
I had same problem too even with the imported module with d.ts files. But for some reason it worked after setting isolatedModules to true "@types/jest": "^24.0.11", |
I ran into this issue as well. I'm running stuff in docker so cache was never persisting. Fixed that with a bind-mount and adding a Still, errors out with the following message anytime I run tests:
This is apparently bc there's no cache yet and the tests seem to not get far enough along for the necessary cache to ever be created. If I add the following line to my
Interestingly, once the tests pass once w this option, it can be removed later and the tests will continue passing as long as I don't delete the cache dir or run things with |
i will close this issue. If anyone still encounters this with latest |
@ahnpnl, here is a minimal repository to reproduce the issue: https://github.com/mfellner/ts-jest-issue-805-demo |
Hi, I would prefer a new issue. Would you please create a new one with your repo and describe the issue ? |
With the last change CircleCI shows some errors regarding the caching, similar to kulshekhar/ts-jest#805 (comment) Adding the flag might solve the problem.
Issue :
Hi,
I've recently tried to update
ts-jest
in one of my projects from 23.1 to 23.10.Commit: DorianGrey/vue-ts-playground@362999f
(There is a level of indirection with
@vue/cli
, but that should not hurt.Everything worked fine at first glance, but then my
pre-push
hook kicked in and complained that it cannot import a.d.ts
file:It's just that the target file is a
.ts
file, thus, it should not expect a.d.ts
file for it to be present at all. Even worse, the test executed fine when executed by my regulartest:unit
task.After a bit of fiddling around, I figured out that the problem is somewhat related to the
--no-cache
option that is used in thepre-push
hook, resp. thetest:unit:ci
task. This flag is not used in the other tasks (which executes fine as mentioned above). Removing that flag from the latter task also makes it work fine.That flag is enabled since the
test:unit:ci
task also collects coverage information, which is known too have some issues when using the flag, esp. when used withvue
components (see e.g. vuejs/vue-jest#56).Expected behavior :
Executing test, i.e. transforming the related files, should work regardless of
jest
's cache being used or not.Debug log:
Added as file attachment, since it's too long to post it directly:
ts-jest.log
Minimal repo :
https://github.com/DorianGrey/vue-ts-playground/tree/ts-jest-update-import-failure
(If that's too large, I may try to put things together in a smaller repro... though it won't be that much smaller. The affected code is quite small, actually).
The failing test can be executed via
Note that the test will work fine if the
--no-cache
is NOT provided.Travis build is here: https://travis-ci.org/DorianGrey/vue-ts-playground/builds/439530439 (test execution is somewhere around L700).
The text was updated successfully, but these errors were encountered: