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

Debugger command missing vitest command #140

Closed
johtso opened this issue Mar 9, 2023 · 4 comments
Closed

Debugger command missing vitest command #140

johtso opened this issue Mar 9, 2023 · 4 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@johtso
Copy link

johtso commented Mar 9, 2023

I've managed to get test running working in my monorepo using workspaces.

When I try and run a debug, the command that gets executed seems to be missing the vite command:

/Users/human/.nvm/versions/node/v18.0.0/bin/node /Users/human/Code/remix-cloudflare-experiment/packages/remix-app/tests/encryption.test.ts -t should encode and decode --api.port 55438 --api.host 127.0.0.1

This means I get an error because of node trying to execute a typescript file.

Any ideas why this might be happening? There must at least be some error checking missing that's allowing a command to execute with no vitest command.

Looking at the code it seems like it usually tries to fall back to a default though..

vitestCommand: { cmd: string; args: string[] } = this.defaultVitestCommand
? this.defaultVitestCommand
: { cmd: 'npx', args: ['vitest'] },

My settings.json:

{
    "vitest.enable": true,
    "vitest.commandLine": "pnpm test",
    "vitest.nodeEnv": {
        "NODE_OPTIONS": "--experimental-global-webcrypto"
    },
}

the test command in my package:

"test": "NODE_OPTIONS='--experimental-global-webcrypto' vitest run",
@johtso johtso added the p3-minor-bug An edge case that only affects very specific usage (priority) label Mar 9, 2023
@koistya
Copy link

koistya commented May 26, 2023

A couple more observations:

  • "vitest.commandLine": "yarn vitest" doesn't work for debugging
  • "vitest.commandLine": "yarn vitest --" doesn't work for running tests (while without -- does)

@segevfiner
Copy link

Also hit this. Had to run vitest manually in the "Javascript Debug Terminal" to debug, but this kinda defeats the point of the extension.

@coryvirok
Copy link

Any update on this? Having to create a new Javascript Debug Terminal each time I want to debug a test is kind of painful.

@sheremet-va
Copy link
Member

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

We don't use Vitest CLI anymore, but call the API directly, so this is no longer a problem.

@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
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

5 participants