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

deep activation #907

Merged
merged 1 commit into from
Sep 13, 2022
Merged

Conversation

connectdotz
Copy link
Collaborator

@connectdotz connectdotz commented Sep 13, 2022

perform deep activation checks so monorepo or projects that require jest.rootPath setting can work automatically.

Also introduced a new marker .vscode-jest to not only activate projects that don't meet the activationEvents, it could also potentially improve monorepo projects support and automate jest.rootPath in a future PR.

Note that the "node_modules" pattern is not deep due to the performance concern.

fix #897
fix #853
fix #711
fix #129

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3048116962

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.614%

Totals Coverage Status
Change from base Build 3047559720: 0.0%
Covered Lines: 2697
Relevant Lines: 2762

💛 - Coveralls

@connectdotz connectdotz merged commit 32b58df into jest-community:master Sep 13, 2022
@connectdotz connectdotz deleted the deep-activation branch September 13, 2022 20:24
@dementors-magnus
Copy link

Would love to try this out! How do I test when there is no release available yet?

@dementors-magnus
Copy link

dementors-magnus commented Oct 6, 2022

@connectdotz I just tried this out in out in our pnpm-workspace/monorepo by following the contributor instructions. The tests are now located and listed in the Test explorer which is quite a step forward!

However I fail to run the test with the error that jest is not found (every package has their own jest.config.js and node_modules/.bin/jest as described below). I can manage to get the tests in the foo-package running by configuring "jest.rootPath": "packages/foo" but then the bar-package won't work.

Is pnpm-workspaces supported with some other kind of configuration?

📦node_modules (no jest here)
📦packages
┣ 📂bar
┃ ┣ 📂node_modules
┃ ┃ ┣ 📂.bin
┃ ┃ ┃ ┗ 📜jest
┃ ┃ ┗ 📂jest
┃ ┣ 📂src
┃ ┃ ┗ 📜foo.test.ts
┃ ┣ 📜jest.config.js
┃ ┗ 📜package.json
┗ 📂foo
┃ ┣ 📂node_modules
┃ ┃ ┣ 📂.bin
┃ ┃ ┃ ┗ 📜jest
┃ ┃ ┗ 📂jest
┃ ┣ 📂src
┃ ┃ ┗ 📜bar.test.ts
┃ ┣ 📜jest.config.js
┃ ┗ 📜package.json

Environment

  1. vscode-jest version: consolidate output and clean up legacy code and settings
  2. node -v: v16.15.1
  3. pnpm --version: 7.12.2
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): N/A
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? "" | "pnpm jest"
    • jest.autoRun? false
  6. Operating system: MacOS 12.6

@connectdotz
Copy link
Collaborator Author

hi @dementors-magnus good that you got it running! 👍

Looks like you have a monorepo project, we support monorepo via vscode's multi-root workspaces. Please see How to use the extension with monorepo projects. This workspace should have 3 folders (project root, 'packages/foo', 'packages/bar') and you can exclude the root folder via jest.disabledWorkspaceFolders.

I hope to cut a release soon, hopefully, this weekend...

legend1202 pushed a commit to legend1202/vscode-jest that referenced this pull request Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants