Skip to content

Nx/Nrwl

Older Versions of Nx/Nrwl (< v8.0.0)

If you are using a version of Nx/Nrwl prior to v8.0.0, then by default Wallaby’s automatic configuration will not work from root of your workspace. Without changes to your jest configuration files, Wallaby can only run for one application or library at a time. When you select your automatic configuration directory, you must select an application/library directory, and not the workspace root directory.

The reason that by default Wallaby.js is limited to only running on one project at a time is that the jest configuration files that are generated by Nx/Nrwl are not valid. That is to say, they cannot be run using npx jest or running jest from the CLI without some changes.

Your on-disk jest configuration files are augmented by @nrwl/jest when you run your tests with ng test. Additionally, the default jest configuration that is specified in the project root will also run your e2e tests, which will result in failures.

To run Wallaby on your entire project, you must ensure that npx jest runs correctly from your application and library root directories, and from your monorepo root directory. Once npx jest runs correctly, you may use Wallaby’s automatic configuration on your entire monorepo.

If jest does not run from the command-line for an application/library, you should be able to modify its jest.config.js to run by adding the following to its jest configuration:

...
setupTestFrameworkScriptFile: './src/test-setup.ts',
globals: {
'ts-jest': {
tsConfig: './tsconfig.spec.json',
diagnostics: { warnOnly: true },
stringifyContentPathRegex: '\\.html$',
astTransformers: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer'
]
}
}
...

Karma or Hybrid Test Frameworks

If your project has been configured to use different testing frameworks for different projects (e.g. karma and jest) then you must create a Wallaby configuration file for each testing framework. Wallaby cannot run for more than one testing framework at a time.

Our Angular CLI docs provide a good example for how to configure Wallaby with karma.

Troubleshooting

If you get stuck or something isn’t working for you, you may find a similar solved issue in our github issues repository. If you can’t find a solution, create a new issue.