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

Support vitest.rootPath option #151

Closed
mizdra opened this issue Apr 26, 2023 · 2 comments
Closed

Support vitest.rootPath option #151

mizdra opened this issue Apr 26, 2023 · 2 comments
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@mizdra
Copy link

mizdra commented Apr 26, 2023

Is your feature request related to a problem? Please describe.
I want to use this extension even in cases where vitest.config.ts is not directly under the workspace root directory.

For example, imagine a workspace with the following directory structure.

workspace-root/
├ .github/
├ backend/
├ ui/
│ ├ node_modules/
│ ├ src/
│ │ ├ index.ts
│ │ └ index.test.ts
│ ├ package.json
│ └ vitest.config.ts
└ terraform/

In this workspace, backend, frontend, and IaC code are clearly separated by directory. vitest is used only for frontend code, so vitest.config.ts is under ui/ directory. Therefore, the extension must run vitest with ui/ directory as the current directory, not the workspace root directory.

However, this extension does not have an option to change the current directory where vitest runs.

Describe the solution you'd like
Add the vitest.rootPath option; vscode-jest has a similar option: https://github.com/jest-community/vscode-jest#rootpath

Describe alternatives you've considered
Nothing.

Additional context
Nothing.

@mizdra mizdra added the p2-nice-to-have Not breaking anything but nice to have (priority) label Apr 26, 2023
@eomeara
Copy link

eomeara commented Aug 18, 2023

I have same problem and same desired fix.

@sheremet-va
Copy link
Member

sheremet-va commented Mar 15, 2024

This should be fixed in pre-release 0.5.0 and higher. Note that the extension now requires Vitest 1.4.0 or higher.

The extension now automatically finds the config and uses it as the working directory. We do not provide any API to change that at the moment.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants