-
Notifications
You must be signed in to change notification settings - Fork 45
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
Configure jest in a monorepo #2263
Comments
Before attempting to start Wallaby, I tried to make sure that your tests were running outside of Wallaby. After cloning your repo and running
It also looks like your Could you please update your repo so that fresh clone, |
Thanks @smcenlly, I had fixed the "presets" error but must have undone it at some point. I'll fix that, but it didn't change the outcome before. For the second one, my understanding of the rush monorepo approach is that there is not a package.json in the root - each project has its own. Rush approaches its projects as a series of separate, standalone entities with Rush as a management layer over top. I could be entirely wrong on this as I'm new to Rush, but I don't believe I got a root package.json when I went through their tutorial to create the project. I also believe that you don't use npm/yarn at the root of the monorepo, but could use it within a given project folder. I'll look into both of these and get back to you ASAP. Thanks, Dave |
I've just gotten confirmation from the Rush team that it isn't "recommended" to run tests from the top-level of the repo. Getting that to work apparently involves some gyrations. Their comment was "Rush treats each project in the repo as an isolated component" So, now the question becomes - can Wallaby be configured to just run the tests in a given project folder if I have the whole repo open? Do I just create a wallaby.js config file in the root of each project? Do I need to do anything special in VSCode to make it work? Thanks. |
Yes - you can run Wallaby on a given project folder, even if you have the entire repo open. Use the I'm not sure on the advice from the Rush team, but if you are using Jest within all of your projects, it should not be hard to get up and running as Jest can be configured to treat each test run as an isolated project. If you can provide us with a working Rush sample with multiple projects configured to use jest, we'd be happy to take a look. Please note that this may require |
@smcenlly: here is a new repo: https://github.com/mann-david/wallaby-error2 This one has 2 projects in the libs folder. Individually, each of them works fine with Jest, but neither works for wallaby. To test this out, you'll need to:
Let me know if you need anything else, or if you make any progress. Thanks! |
Thanks for the sample repo. Because you are using I have created a pull request that removes your After merging the pull request you will first need to run To run all tests in your project, in VS Code run the command |
Thanks @smcenlly. I just tested this and things look good. There is still an warning in the Wallaby Console ("Unable to find the root of the project where ts-jest has been installed") but everything appears to work just fine. |
We hadn't seen this I found a few
|
Attempting to run wallaby in a Rush (https://rushjs.io/) monorepo and it is failing trying to use jest.
I had a project running as a plain JS project with jest and wallaby successfully. Then I moved it into a Rush monorepo and it fails trying to use Jest. At this point, I've worked myself in circles and am afraid I've broken more than I've fixed. :-(
When I add
testFramework: 'jest'
to my wallaby.js config I get an error when starting wallaby:Failed to load configuration file: Test framework [[email protected]] is not supported
.When I try to reference jest in a test (i.e. const z = jest.fn()) it fails saying jest is not defined.
Again, this worked before I moved it into the monorepo, so for some reason wallaby can't seem to find something it needs.
I've updated Wallaby Core to 1.0.778
Sample repo: https://github.com/mann-david/wallaby-error
Thanks.
The text was updated successfully, but these errors were encountered: