Wallaby.js supports projects that use Yarn 2.
To start Wallaby with a Yarn 2
project, start Wallaby as you normally would.
Resolving Dependency Issues
Some Wallaby internals need to dynamically load your project dependencies
and patch them both at runtime and in the file system. Depending on your project type
and the packages you are using, sometimes Wallaby may fail to load without modifications
to your .yarnrc.yml
file.
If this happens for your project, an error similar to the one below will be reported
to your Wallaby Console
:
Failed to initialize wallaby.
{PACKAGE_1} tried to access {PACKAGE_2}, but it isn't declared in its dependencies;
this makes the require call ambiguous and unsound.
Required package: {PACKAGE_2} (via "jest-runtime")
Required by: {PACKAGE_1}
Require stack:
...
If this happens for your project, you need to add those packages as dependencies of your project
in your .yarnrc.yml
using the packageExtensions
section. After adding the packages
be sure to run:
yarn install
Repeat the process until all dependency issues have been resolved.
Jest Settings
If you are using jest
with Yarn 2
, you need to set your packageExtensions
as shown below:
yarnPath: ".yarn/releases/yarn-berry.cjs"
packageExtensions:
jest-config@*:
dependencies:
jest-runtime: "*"
jest-cli@*:
dependencies:
"@jest/reporters": "*"
"@jest/console": "*"