-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add support for yarn2 #2351
Comments
Wallaby doesn't currently provide first-class support for yarn's PnP feature but does allow you to specify your |
I've tested yarn v2 with so many projects.. none of them work at it's current state. |
As of today, we have set up and spent a little time investigating We were looking for a few simple projects that use yarn2 and have tests configured and couldn't find much in the way of examples or instructions for configuring. If you have a sample project (e.g. that uses yarn2 with jest), we'd appreciate you sharing with us. |
Last week, we spent the last 3 days completing our investigation on how to add yarn2 support to Wallaby. We were hoping we would be able to implement this in a couple of days but it looks like it will take at least 1-2 weeks for us to get this working properly. We have existing short term commitments/plans that we need to complete before starting this work. We expect to know where this will fit on our schedule this in about 3-4 weeks time. If you're reading this comment, please +1 the issue description to let us know you're interested in this feature (and have others you know who are interested do so as well). |
@smcenlly Do you have any updates to share? |
@mdreizin - at this stage, we have some other features and enhancements planned out until mid-December and don't expect to revisit |
@smcenlly Thank you for sharing this. |
If anyone is looking, I was able to use yarn 2 pnp in my Create React App/Craco/Typescript project:
|
@zombopanda - thanks for sharing |
I can confirm @zombopanda's solution. @smcenlly @ArtemGovorov do you have any update on the timeline for supporting Yarn 2/PnP out of the box? Would be greatly appreciated! |
I'm unable to get @zombopanda's solution working. Still getting the following in my VSCode output: [Error] Automatic Jest configuration error: Module jest-cli is not found in '.'. I have the following in #!/bin/bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
node -r ../.pnp.js "$@" and this in "wallaby": {
"autoDetect": true,
"testFramework": {
"configFile": "./jest.config.js"
},
"env": {
"type": "node",
"runner": "./bin/node.sh",
"params": {
"runner": "-r ./.pnp.js"
}
}
} Followed the other instructions as well, just listing what I've specifically changed. It wasn't entirely clear where I should be placing the shell script, nor do I know how to select the NodeJS wrapper in the Wallaby run config (is this something specific to the WebStorm plugin? Doesn't seem to be an equivalent for VSCode...). Would really love to get this working! |
The final step:
is a little different in VS Code. In VS Code, you will need to set the node path in VS Code's Wallaby Configuration, A relative path should work but if it does not, please try providing the absolute path to your shell script. Please also ensure that your shell script has executable permissions |
Thanks! This was what I needed. Also useful to note that this can be saved to {
// ... other settings...
"wallaby.node": "./bin/node.sh"
} so that you can share this essential config with your team. |
I was able to get this working without so much added configuration. I did only two things,
This relies on yarn to stand up the correct environment. Step #2 could be skipped if the |
@doublemarked Thanks so much that worked for me. To anyone trying to figure this out in the future two things to watch out for: Looks like If you get an error like |
This solution appears to no longer be working for me. Haven't worked in my yarn 2 repo for a few weeks, settings haven't changed AFAIK since I'm the only one on my team that uses Wallaby at the moment. When I try to start it up, I now get the following error in VSCode:
As @doublemarked pointed out, I believe if we could just opt into using Edit: It works again if I use an absolute path to |
@Saeris - this is working for me. Perhaps try setting the absolute path to your Also, can you share your node.sh contents? If you are using |
We have added native support for Please note that depending on your project type, you may need to resolve dependency issues by modifying your yarnPath: ".yarn/releases/yarn-berry.cjs"
packageExtensions:
jest-config@*:
dependencies:
jest-runtime: "*"
jest-cli@*:
dependencies:
"@jest/reporters": "*"
"@jest/console": "*" |
Out of curiosity, are those extensions needed because Wallaby injects code into the |
The package extensions are required because |
Issue description or question
Hi, do wallaby works with yarn2 and PnP API?. If yes, can you get me some info about config?
The text was updated successfully, but these errors were encountered: