-
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
BabelConfig with rootMode: "upward" not loading babel config files #1341
Comments
Interesting, I never use this rootMode of Babel so I wasn’t aware that it didn’t work for ts-jest. Thanks for submitting the issue 👍 |
Manually passing the config means you use require or absolute path to your Babel config ? |
Manually passing means copy / paste 😃 |
You can use require() or string absolute path to save your time :) it is described in the documentation. |
Yeah, but I want this to be extracted as a base config, so it would not work for multiple packages (with their own babelrc configs) |
Btw, do you have the log file of ts-jest after running tests ? I’m interested to see where ts-jest locates your root babelrc. Is it your issue about using rootMode: ‘upward’ and root config babelrc isn’t loaded ? (Correct me if I’m wrong) |
Logs: https://pastebin.com/SfS43ddg It is supposed to load |
what I can see from the log is actually So the main issue here is So temporarily workaround is you copy the content of babel config in your subpackages and paste to
The question here is how does What do you think @kulshekhar ? I think perhaps for loading babel config, if user specifies |
Given that this is a one time setup, isn't the suggested workaround sufficient? |
I think the bug might be about the way ts-jest searches for babel config. I checked the logic and in the case of rootMode: ‘upward’, ts-jest skips finding babelrc in the current folder level, only takes the line config and then go up to root to get Babel config root. My suggestion is if user defines rootMode: ‘upward’, we should try to find Babel config on the current level first then go up to root to merge with Babel root config. That’s also the way I understood by inspecting how Babel config works. |
Isn't it possible to delegate this to |
Indeed I like that approach. However I'm not sure how to do it. So how
So I can understand that |
@arvigeus , I found out the main cause of your issue. It is caused by invoking babel to load config here. So if |
A simple monorepo with the following config:
When I run
yarn test
it works as expected. When I runyarn lerna run test
,ts-jest
fails to load babel configs. If I usebabel-jest
instead ofts-jest
, it works fine. The only way to make it work is to manually pass the entire babel config toglobals[ts-jest].babelConfig
.Maybe something like
globals[ts-jest].babelConfig.babelrc: true
would be nice in such case to allow loading configs. It didn't worked withglobals[ts-jest].babelConfig: true
Minimal repo
https://github.com/arvigeus/monotest
The text was updated successfully, but these errors were encountered: