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

Vitest doesn't discover tests when pointed at monorepo root #5409

Closed
6 tasks done
roryschadler opened this issue Mar 20, 2024 · 1 comment · Fixed by #5408
Closed
6 tasks done

Vitest doesn't discover tests when pointed at monorepo root #5409

roryschadler opened this issue Mar 20, 2024 · 1 comment · Fixed by #5408
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@roryschadler
Copy link

Describe the bug

I have a yarn-workspace-powered monorepo which has vitest installed in both of the packages as well as the root. When I run yarn test /absolute/path/vitest-non-root-monorepo/typescript-project (with/without trailing slash), I get the following error:

yarn test /Users/roryschadler/testing/vitest-non-root-monorepo/typescript-project/       

 DEV  v1.4.0 /Users/roryschadler/testing/vitest-non-root-monorepo/typescript-project

filter:  /Users/roryschadler/testing/vitest-non-root-monorepo/typescript-project/
[client] Config
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
[server] Config
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
watch exclude:  **/node_modules/**, **/dist/**

No test files found, exiting with code 1

If I run yarn test /absolute/path/vitest-non-root-monorepo/typescript-project/client or ...client/, the tests under client run just fine.

Reproduction

https://github.com/roryschadler/vitest-non-root-monorepo

System Info

System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Max
    Memory: 257.94 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.6.1 - ~/.nvm/versions/node/v20.6.1/bin/node
    Yarn: 3.6.3 - ~/.nvm/versions/node/v20.6.1/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v20.6.1/bin/npm
  IDEs:
    Emacs: 29.2 - /opt/homebrew/bin/emacs
    VSCode: 1.87.2 - /usr/local/bin/code
    Vim: 9.0 - /usr/bin/vim
    Xcode: /undefined - /usr/bin/xcodebuild
  Browsers:
    Chrome: 123.0.6312.58
    Edge: 122.0.2365.92
    Safari: 17.4
  npmPackages:
    vitest: ^1.4.0 => 1.4.0

Used Package Manager

yarn

Validations

@roryschadler
Copy link
Author

Related: vitest-dev/vscode#308, #5408

cc @sheremet-va

@sheremet-va sheremet-va added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Mar 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants