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

Can't use in a monorepo where each project has a different tsconfig.json #535

Closed
Xapphire13 opened this issue May 22, 2018 · 4 comments
Closed

Comments

@Xapphire13
Copy link
Contributor

Xapphire13 commented May 22, 2018

ts-jest: 22.4.6
Structure of project

<rootDir>/
|- packages/
   |- package1/
      |- tsconfig.json
      |- src/
      |- tests/
         |- tsconfig.json
   |- package2/
      |- tsconfig.json
      |- src/
      |- tests/
         |- tsconfig.json

Issue

In a monorepo where each project has a tsconfig.json I cannot run jest as it cannot find a tsconfig.json
image

Expected behavior

ts-jest should use the tsconfig.json file closest to the file being tested that is applicable for the file (the same way tsc and tslint work).

@GeeWee
Copy link
Collaborator

GeeWee commented May 22, 2018

Do you use jest projects here, or are they simply in subfolders?

@Xapphire13
Copy link
Contributor Author

I am using the jest projects config. Though I don't know if I'm doing it right =]. This is the first repo i've tried to make into a monorepo. Here is the repo link: https://github.com/Xapphire13/xapphire13.com

@nolazybits
Copy link

Have a look here.
I have posted my working solution there
jestjs/jest#3112

@Xapphire13
Copy link
Contributor Author

I figured out using a combination of trial and error and @nolazybits's solution that basically, each project needs to have its own jest configuration in the package.json to work.

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

No branches or pull requests

3 participants