-
Notifications
You must be signed in to change notification settings - Fork 455
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
ts files in node_modules is not transformed #1294
Comments
If you set target to |
@ahnpnl It seems commonjs is not an option. And If it is, commonjs does't support circular import as far as I know. |
sorry my bad, |
@ahnpnl I should have guessed that. I changed the tsconfig to be:
still no good |
I think in this case, the ts files in For example: |
Hi, Do you still encounter the issue ? If yes, please check my latest comment. If still not working, please provide a minimal reproduce repo. Thanks 👍 |
Hi, I have also been having this problem and have produced a minimal repo that demonstrates it. You can find it here: https://bitbucket.org/s_parkinson/ts-jest-bug-example Weirdly, the tests run the second time you try to run them, so I have provided a Dockerfile to run this in a docker and make it repeatable. Across different repos I have with this issue, sometimes the second time I run the tests after installing it runs successfully, sometimes the 7-8th time it runs successfully?? which is a nightmare for CI. If you could help with this it would be amazing. Thanks, Sam |
thank you for you repo. Do you run test inside your |
yes, exactly. As in the Dockerfile.
but note, when doing it on your machine, the tests may pass on the second or third run. They do on mine. |
There seems to be an invalid config, I got error from jest
|
ok, weird, that worked on mine and in the docker image. I have pushed a change that may fix it for you. |
FYI I just found that the bug is reproducible on my local machine by running |
Just fetch and pull, your change didn't work, however I can run your test by running
is this the error you saw ? |
Yes, that is the error I saw. Nice one. Sorry for the issue with getting the test running |
is your repo is a monorepo type ? |
this test repo is, but not my production code. for the production code I have a similar setup, but I am using |
if your real repo is also monorepo, please take a look at #1343 . At the moment |
Ok, so do you need a different example minimal repo where it isn't a monorepo? The same issue appears in my production code, which isn't a monorepo. |
oh, no that is just FYI, I've seen this error occuring some other places as well, #1289 probably related |
ok, great. Let me know if there is anything else I can do to help. |
FYI, I did a quick debug, coming out that it failed when ts compiled file
The 2nd there are only 2 files compiled by ts:
It looks quite strange that:
I'm not so experience with this error so I don't have a clue yet Updated:
|
You're right. Nice one. That does fix it for the monorepo case. Unfortunately, it does not fix it for the case where the library is not symlinked... As you might expect. I have created a new repo that shows this: https://bitbucket.org/s_parkinson/ts-jest-bug-example-no-monorepo I guess they are different issues. |
Thanks I will take a look when I have some free time 👍 updated: I can't access the URL of your repo above @sparkinson. I think it's easier if you put your repo on github or gitlab. |
My project imports ts files in a package in node_modules, and when I run
npx jest
, error happend:It seems that ts-jest is ignoring the file in node_modules.
My config is:
The text was updated successfully, but these errors were encountered: