-
Notifications
You must be signed in to change notification settings - Fork 454
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-jest 26.1.2 - "cannot find source file" #1506
Comments
Would you please provide us the reproduce repo ? The information is very limited so it's very difficult for us to investigate. We need:
Also please follow the bug report template. Those are the useful information that can help us. |
Logs:
Working on a repro |
@ahnpnl https://github.com/pburkindine/tsjest-cannot-find-source-file Just adding (this is the test file: https://github.com/pburkindine/tsjest-cannot-find-source-file/blob/master/apps/tsjest-cannot-find-source-file/src/app/app.component.spec.ts) After running it the first time and getting the error, I noticed I needed to upgrade jest in the repro to match my environment. After the upgrade, the test passed. Then I changed "foo = 'bar'" to "baz = 'quu'" in the component and ran the test, and it failed again with the log below: Log:
|
does clear jest cache and rerun help ? |
yes, running |
oh I think I know, it's related to the fix for #1390 . For some reasons it doesn't work for your case |
I have the same issue with all my typescript projects since the update to At the moment, all I can do is keep running I set up an example repo that mimics my project setup if it's of any use: I included a GitHub CI test workflow in the repo. If you look at the workflow logs you'll see the test managed to complete even after I changed the value of 'foo' in the source file. However, when I do the same thing on my own machine I get the following: FAIL __tests__/index.test.ts
● Test suite failed to run
Could not find source file: '/mnt/f/dev/projects/ts-jest-error-could-not-find-source-file/__tests__/index.test.ts'.
at getValidSourceFile (node_modules/typescript/lib/typescript.js:135637:29)
at Array.forEach (<anonymous>)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.701s
Ran all test suites. I also tried cloning the repo to a Digital Ocean droplet and running it there, and I still got the same error. |
thank you guys for the information, will look into it asap. Stay tune :) Updated: would you guys please test the fix with this tgz file https://drive.google.com/open?id=1QRnkDOIy7BXQdSjcybzveBkmE1uCU8h5 |
It works for me 👍 |
@ahnpnl yeah, fixes it for me as well, thanks |
thank you guys, will open a PR for it. |
👋🏽just hit this same issue in VSCode, I can workaround by running |
cc @kulshekhar |
This bug is still present on version |
Yup, clearing the jest cache solves it. |
Same here with v26.1.3. Jest tries to run deleted spec files. We have a heavy pipeline with hundreds of tests and clearing Jest cache is not an option as it drastically increases running time. Are there any other options? |
after clearing cache, does it still happen after using for a while ? The problem is because new version cannot reuse the old cache, therefore clear cache is required for 1st run. |
first time it happened on v26.1.2. we bumped to v26.1.3 and the issue vanished away to re-appear the next day. If it helps, we have a nightly job that clears and rebuilds Jest cache so I'm 100% sure the issue happened on v26.1.3 with the updated cache. |
it would be nice if you can provide a reproduce scenario. I tested with the 2 repos provided here but the issue doesn't appear. |
Same here with jest and ts-jest versions 26.1.0 Error output:
DashboardChooserContainer.test.tsx was not available, as it was renamed to DashboardContainer.test.tsx Probably you can reproduce the issue by running the tests, then renaming one of the test files. |
I believe this issue should be reopened. |
do you use watch mode or non-watch mode ? Hmm I tried renaming but I don't see the issue either. I might know how to fix it but need reproduce steps that can verify the fix. I think the steps are:
|
Hi @magwas, @x87, @dwjohnston, @lmanerich, @impulse v26.1.4-alpha.0 is out with the fix. Would you guys please test it by install ts-jest@next ? If it works, I will publish a new release and close this issue. Let me know |
@ahnpnl using this version right now, so far so good. |
hi, does 26.1.4-alpha.0 solve the issue completely ? If yes, maybe 26.1.4 can be released ? |
no issues for me |
v26.1.4 is out, I will close this issue |
Add test for build args Update jest and ts-jest to resolve an issue where the test file is missing: kulshekhar/ts-jest#1506
* Add option to add --build-arg's to docker Add test for build args Update jest and ts-jest to resolve an issue where the test file is missing: kulshekhar/ts-jest#1506 * Update action, readme, dist and version number
This bug is still present in the latest version, at least with Next.js serverless functions. |
I also use the latest version and had this problem, only in watch mode, the normal tests passed perfectly. After clearing the cache it was fixed. |
Still present, cleaning cache doesn't solve, google drive links in this thread are useless as they can be deleted. |
🐛 Bug Report
When attempting to run jest tests with VSCode debugger in 25.3.1, I keep getting error "cannot find source file" after making seemingly innocuous changes to the spec or tested file. Reverting the changes to the source file allows the tests to run. Reverting to 25.2.1 fixes the error.
The text was updated successfully, but these errors were encountered: