Skip to content
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

Running "Jest: Setup Extension" doesn't work #827

Closed
the21st opened this issue Jan 12, 2022 · 6 comments
Closed

Running "Jest: Setup Extension" doesn't work #827

the21st opened this issue Jan 12, 2022 · 6 comments

Comments

@the21st
Copy link

the21st commented Jan 12, 2022

I'm getting this message:

Jest: Setup Extension (Beta)' resulted in an error (command 'io.orta.jest.setup-extension' not found)

image

Environment

  1. vscode-jest version: v4.2.1
  2. node -v: v14.15.5
  3. npm -v or yarn --version: yarn 2.4.1
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): I'm using yarn PnP
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? N/A
    • jest.autoRun? N/A
    • anything else that you think might be relevant? N/A
  6. Operating system: MacOS 12.1

Prerequisite

  • are you able to run jest test from the command line? yes
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) yarn run jest ... when inside a specific package or yarn workspace <package> run ... when in repo root

Steps to Reproduce

I'm in a yarn2 PnP monorepo with multiple packages.

Relevant Debug Info

Expected Behavior

The setup wizard is run

Actual Behavior

An error dialog appears

@connectdotz
Copy link
Collaborator

hmm... this is strange, did you see "Jest" in the status bar? If not, please check out the "I don't see "Jest" in the bottom status bar" in troubleshooting section to see if it helps.

The current workspace support is based on vscode multi-root project. It would be nice to support native yarn or jest workspace/projects settings one day, but at least for now, you can easily use mutltiroot to work around it.

@the21st
Copy link
Author

the21st commented Jan 21, 2022

did you see "Jest" in the status bar?

I don't see "Jest" in the status bar. The troubleshooting section doesn't help me figure out the problem. This comment originally led me to try the wizard, but it seems I'm stuck in a catch-22 situation.

I tried setting jest.rootPath directly to one of the package dirs in my monorepo but that didn't help either.

The current workspace support is based on vscode multi-root project

I'm not sure if this could work with yarn workspaces – lots of our config lives at the root level of the monorepo, e.g. .eslintrc.js and a top-level package.json.

@connectdotz
Copy link
Collaborator

will you be able to create a sample repo to help us investigate further?

@connectdotz connectdotz added the need sample repo needs a sample repo to further investigate label Jan 25, 2022
@the21st
Copy link
Author

the21st commented Jan 27, 2022

@connectdotz here it is: https://github.com/the21st/yarn-2-workspaces-monorepo-example

Running yarn and then yarn workspace @miq/myapp-1 jest inside the repo will succesfully run jest tests in the @miq/myapp-1 package, but "Jest: Setup Extension" command doesn't work in vscode in this repo.

@connectdotz
Copy link
Collaborator

connectdotz commented Jan 27, 2022

@the21st thanks for the repo. I was able to reproduce the error, however as I mentioned earlier, the way this extension supports monorepo is via vscode multiroom workspaces, which is pretty easy to do. Once converted, the sample repo worked perfectly.

I have created a PR(the21st/yarn-2-workspaces-monorepo-example#1) against your sample for such conversion (just one file actually). Let me know if you still have any problems...

@connectdotz
Copy link
Collaborator

This should be addressed by the following v5 features:

  1. deep activation, you should not see the extension not found error
  2. monorepo setup tool can then easily auto config the project to be multi-root.

Close this issue but feel free to reopen it if you have other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants