Skip to content
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

fix: #825 handle symlinked modules (ala pnpm) correctly #1176

Merged
merged 1 commit into from
Aug 19, 2019
Merged

fix: #825 handle symlinked modules (ala pnpm) correctly #1176

merged 1 commit into from
Aug 19, 2019

Conversation

aquark
Copy link

@aquark aquark commented Aug 16, 2019

I was having problems with ts-jest failing to compile in my pnpm monorepo with weird errors because it apparently wasn't finding dependencies of @types packages, despite the fact that tsc works fine. This change fixes it.

The reason is that pnpm symlinks packages like this:

> ls -l node_modules/@types/
express -> ../../../../node_modules/.registry/@types/express/4.17.0/node_modules/@types/express

The transitive dependencies are not in the consuming package's node_modules or its parents, instead they are in ../../../node_modules/.registry/@types/express/4.17.0/node_modules/, so it's necessary to resolve the symlink to its referent in order to find the dependencies. When ts-jest doesn't implement this resolution, TypeScript assumes all the files are not symlinks and doesn't find the dependencies. Depending on how dependencies are structured this results in missing type information which causes strict type checking to fail.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2888

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 91.601%

Totals Coverage Status
Change from base Build 2864: 0.0%
Covered Lines: 915
Relevant Lines: 967

💛 - Coveralls

@kulshekhar
Copy link
Owner

@aquark thank you very much for the PR!

@kulshekhar kulshekhar merged commit 8297bf2 into kulshekhar:master Aug 19, 2019
@bruk1977
Copy link

@kulshekhar I need this fix very badly... do you have any idea when this fix could be released? Looks like that last release is last April :(

@bruk1977
Copy link

@aquark are you using this fix? do you publish it by a different name? Looks like the latest release don't have this fix.

@aquark
Copy link
Author

aquark commented Sep 12, 2019

Yes, I'm using it with a private npm registry

@bruk1977
Copy link

Thanks @aquark for the quick reply. When I'm trying to publish to a private npm registry, I'm getting the following errors... any idea how to get around them?

ts-jest/e2e/helpers/source-maps.ts:1:50
ERROR: 1:50 prettier Delete

ts-jest/e2e/helpers/templates.ts:1:26
ERROR: 1:26 prettier Delete
ERROR: 2:23 prettier Delete
ERROR: 3:27 prettier Delete
ERROR: 4:41 prettier Delete
ERROR: 5:13 prettier Delete
ERROR: 6:51 prettier Delete
ERROR: 7:2 prettier Delete
ERROR: 8:104 prettier Delete
ERROR: 9:109 prettier Delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants