Closed abalhier closed 3 years ago
Thanks for providing your Wallaby diagnostics report. We can see that you have manually configured Wallaby to use our older version of jest
integration.
Since late 2019, starting from jest
v24
, a configuration file is no longer required to start using Wallaby with jest
. Specifying a manual jest
configuration is no longer supported from jest
v27
. Please switch to use automatic configuration, it should work for you.
If you're having problems with automatic configuration
, please let us know.
Thank @smcenlly for your response.
I work with @abalhier on the same project. We have succeed to have wallaby partially working using automatic configuration
.
Our project is a mono repo, managed by lerna, with nodejs modules and reactjs browser modules. Our tests need some setup and hence we moved what we had before in our wallabyjs conf file into a jest config
file on top of our mono repo.
The first issue we ran into is that jest config files in our sub modules are not used by wallaby. Since we have nodejs code and reactjs code, some tests need jsdom
test environment whereas other need node
test environment.
When we focus on reactjs tests, using jsdom
test environment, we have some weird errors "ReferenceError: React is not defined" on tsx files where React is not imported (no problem at runtime with those files since we use reactjs v17...).
Thanks for your help
@alexvictoor - does jest
work for you when running from the mono repo root (outside of wallaby)?
@smcenlly I get the same issue with react files. I guess only the jest config file located at the mono repo root is taken into account. Maybe the behaviour changed between jest26 and jest27. Would it be possible for wallaby to take into account jest config files located in sub modules?
I get the same issue with react files
I assume you are saying that you get the same problem outside of Wallaby when using jest?
Would it be possible for wallaby to take into account jest config files located in sub modules?
Wallaby can use the jest config files located in sub modules if you specify to run a single project using the VS Code command, Wallaby.js: Select Configuration
and then select Automatic Configuration <custom directory>...
.
If you already have a jest configuration in your mono-repo root and it is no longer working for you, we suggest that you update it to run all of your projects, and then Wallaby should also work (i.e. fix jest to run from the CLI and then start Wallaby).
If you have an existing jest configuration that you want to be separate to running the sub-projects, then you may create another jest configuration, e.g. jest.config.wallaby.js
and manually specify for Wallaby to use that configuration instead with a Wallaby configuration file:
wallaby.js
module.exports = () => {
return {
// tell wallaby to use automatic configuration
autoDetect: true,
testFramework: {
// the jest configuration file path
// (relative to project root)
configFile: './jest.config.wallaby.js'
}
}
};
You should be able to create a jest.config.js
in your mono-repo root that includes all of the sub-projects:
jest.config.js
module.exports = {
projects: [
'<rootDir>/api/',
'<rootDir>/web/',
'<rootDir>/mobile/',
],
}
I'm assuming that my last reply helped you get things working and am closing the issue. If you're still having problems, please reply with more detail and we will reopen.
Thanks it helped fix our problem !
Issue description or question
Hello,
We have a monorepo with lerna and typescript. Since we upgraded to Jest 27.0.6 from 26, we get an error when launching Wallaby :
Wallaby diagnostics report