Closed shanehsi closed 8 months ago
Since you have both vitest
and jest
installed for your project, Wallaby tries to use vitest
first, and you'll receive the error that you describe.
You can create a Wallaby configuration file and tell Wallaby to only attempt to start using Jest. For example:
module.exports = ({
// Only attempt to start using Jest
autoDetect: ['jest']
});
If your jest is configured within your NX
workspace configuration (vs. using jest.config.js
file), then you will need to tell Wallaby to use Angular as the auto-detect setting. NX was originally an offshoot of angular and it remains that way in Wallaby's internally processing:
module.exports = ({
// Only attempt to start using Angular/NX workspaces
autoDetect: ['angular']
});
Thank for your quick response. I already set autoDetect
to Jest ( see the diagnostics up), and angular by your advice.
It worked before, but seems that it's no longer working.
module.exports = function (wallaby) {
return {
// Tell Wallaby to only try configuring with vitest
// Default is: ['angular', 'jest', 'vitest']
autoDetect: ['angular'],
// Limit how many processes Wallaby will use, for example:
// 1 process for incremental runs, 2 processes at startup
workers: { regular: 1, initial: 2 },
// modify `files` automatic configuration settings
files: {
override: filePatterns => {
// TODO: modify `filePatterns` array as required
// return filePatterns;
return ['libs/cms-admin-services/src/**/*.ts', '!libs/cms-admin-services/src/**/*.spec.ts']
},
},
// modify `tests` automatic configuration settings
tests: {
override: testPatterns => {
// TODO: modify `testPatterns` array as required
// return testPatterns;
return ['libs/cms-admin-services/src/**/*.spec.ts']
},
},
}
}
Thanks for letting us know. This was a regression (bug) that we introduced last week.
This is fixed in the latest version of Wallaby core, v1.0.1549
. Please run the VS Code command, Wallaby.js: Force Core Update
, it should update to the latest version and work for you.
Thanks very much, you saved my day!.
Issue description or question
In the nx repo, it's no longer possible to force Wallaby to run Jest. Previously, it was possible. It seems that Wallaby is reading the defaultProject from nx.json, and this defaultProject is configured using Jest. I would like to know if it's possible to force Wallaby to use Jest.
more backgroud: This project is an nx monorepo. Some projects are configured with Jest, while others have switched to using Vitest (for speed). However, it was discovered that Wallaby has some issues when running on Vitest (old versions, I do not want to upgrade now) and it's not working out of the box. On the other hand, Jest is very stable.
Wallaby diagnostics report