-
Notifications
You must be signed in to change notification settings - Fork 238
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: Bubble up file tree to find jest
#888
Conversation
Handles the edge case of a monorepo where jest is installed inside a submodule only. cannot guarantee that the CWD is always the current project. Monorepos intend to bubble up the test/lint functionality to the root folder rather than all submodules.
jest
jest
You can use an @G-Rath thoughts? |
@SimenB, Thanks for the quick reply.
I'll need more information and an example of this. I don't anticipate this would solve my issue since it is specifically the I would also request you to reconsider the "cleverness" because the current code also assumes that the |
I think this patch has us being too clever - we attempt to find However I do think I was silly to include @codejedi365 could you see if you still have issues if you remove the
It will, because our |
I did remove paths completely and it actually ran successfully! I'll adjust my PR shortly to use this similar fix. I suspected node's |
@codejedi365 I've already got a PR opened for this, but it's also made me realised that the larger bit of work we have to do is adjusting our tests (which I now suspect is why I had it there in the first place, since it appeared like it was working) Are you ok if I close this PR in favor of #889? |
🎉 This issue has been resolved in version 24.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 25.0.0-next.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Problem
I ran into an breaking error when trying to run eslint at the root level of a monorepo and the jest plugin was used by a submodule and only loaded within the submodule context.
Monorepos desire to run test/lint functionality from the root folder rather than all submodules which can cause conflicts with what the
process.cwd()
is set to.Error log:
With a little debugging, I was able to identify the following variables were currently set to:
My project was laid out:
Alternatives
package.json
as a configuration option. I would rather not do this since I would have to keep the definition in sync from the root project and the submodule's package definition.Solution
This small loop bubbles up the file tree when it detects the edge case where the
eslint-plugin-jest
module is installed in a submodule's dependencies only and theprocess.cwd()
does not directly match.