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

How to configure Wallaby to run with lerna packages, each with their own jest.config.js #2478

Closed
ryall opened this issue Jul 13, 2020 · 2 comments

Comments

@ryall
Copy link

ryall commented Jul 13, 2020

My project is currently configured using multiple Lerna packages, each with their own jest.config.js setup.

If I copy and paste the wallaby.js config to each package root directory and select the configuration every time I change packages, everything works well.

<root>/
    packages/
        lib-one/
            jest.config.js
            wallaby.js
        lib-two/
            jest.config.js
            wallaby.js
        lib-three/
            jest.config.js
            wallaby.js
    package.json

However, this becomes very tiresome with the more packages I add to the project.

Instead I'd prefer to have a single master wallaby.js configuration in the project root and load all the configured packages (including their independent jest.config.js files) at once, so that I don't have to keep switching configurations.

<root>/
    packages/
        lib-one/
            jest.config.js
        lib-two/
            jest.config.js
        lib-three/
            jest.config.js
    package.json
    wallaby.js

Experimenting with the config, I was unable to achieve this.

@smcenlly
Copy link
Member

To get Wallaby working, Jest must be installed in the mono-repo root. You must also configure jest to run from your mono-repo root (i.e. from the CLI with npx jest). To do this:

  1. Install jest in your <root> directory.
  2. Configure jest to run for your entire mono-repo using npx jest from the CLI at the mono-repo root. For example:
// <root>/jest.config.js

module.exports = { 
  projects: [
    '<rootDir>/packages/lib-one/jest.config.js', 
    '<rootDir>/packages/lib-two/jest.config.js',
    '<rootDir>/packages/lib-three/jest.config.js',
  ] 
};

@ryall
Copy link
Author

ryall commented Jul 14, 2020

Took a while because of the Babel CWD issue (jestjs/jest#7359) but managed to get it working. Thanks!

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

2 participants