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

Allow overriding the command used to invoke vitest #583

Closed
4 tasks done
coreyward opened this issue Feb 6, 2025 · 3 comments
Closed
4 tasks done

Allow overriding the command used to invoke vitest #583

coreyward opened this issue Feb 6, 2025 · 3 comments

Comments

@coreyward
Copy link

Clear and concise description of the problem

I use a script in my package.json to configure various ENV vars and settings when invoking vitest. I would like to configure the extension to use pnpm test to run vitest so my configuration can be shared.

This is basically identical to #366, but despite that issue being closed, there does not appear to be a solution (see below).

I wound up losing my entire development database because I have some tests that verify the database is working correctly using a separate test instance.

Suggested solution

Support a commandLine configuration in the VSCode settings. E.g.,

{
  "vitest.commandLine": "pnpm test"`
}

Alternative

I saw the various other commands like shellType, but they don't appear to be useful for this scenario.

Additional context

No response

Validations

@sheremet-va
Copy link
Member

sheremet-va commented Feb 7, 2025

The extension doesn't use vitest command, it starts a custom node script, so we cannot expose a way to use custom commands. If you need a certain environment, you can use shellType: 'terminal' with a custom vscode terminal setup. You can also setup custom env with vitest.nodeEnv settings option.

@coreyward
Copy link
Author

Ah, interesting. I was able to get the nodeEnv to work, but I worry about drift as these commands change. I saw what was in the README re: shellType, but I don't grok how it functions or how to configure it. Are there any examples or additional docs available?

@sheremet-va
Copy link
Member

terminal shellType just uses your default vscode terminal. You can configure it using default vscode settings.

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