Skip to content

Extension discovers tests but does not run them when Vitest is installed above the root #308

@roryschadler

Description

@roryschadler

Describe the bug

I have a monorepo1 which has two components, a Python tool and a TypeScript project. I've installed vitest in the TypeScript project, which isn't the root of the repo, and when vitest is run from the command line in that subdirectory, it works fine.

This extension does discover the tests just fine2, but will not run them if I click the run button on the top level of the tree (typescript-project in the screenshot below).

It will run them if I click the run button for client or server, which I've confirmed by setting up a side effect for the test and seeing it occur. But it will not report the test results in this case.

I'm running the latest pre-release version of this extension (0.5.6 as of now). Thank you all for looking into this, I really appreciate it!

Reproduction

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

System Info

...vitest-non-root-monorepo/typescript-project % npx envinfo --system --npmPackages '{vitest,@vitest/*,vite,@vitejs/*}' --binaries --browsers --IDEs

  System:
    OS: macOS 14.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 377.92 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: 122.0.6261.129
    Edge: 122.0.2365.92
    Safari: 17.3.1
  npmPackages:
    vitest: ^1.4.0 => 1.4.0 ```

Used Package Manager

yarn

Validations

Footnotes

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

  2. Screenshot 2024-03-19 at 1 24 26 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    p4-importantViolate documented behavior or significantly improves performance (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions