vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
740 stars 83 forks source link

VSIX Vitest Extension not providing UI button or recognizing tests #286

Closed mujevich closed 6 months ago

mujevich commented 6 months ago

Describe the bug

I had initially set up my project using the now deprecated Vitest Extension, and have now migrated to the currently supported version

My issue is that after migrating, my test no longer have the Play / Debug options next to them and the tests don't seem to be recognized. I'm still able to run my tests via the command line however.

image

Reproduction

N.A

System Info

"vitest.enable": true,
"vitest.changeBackgroundColor": true,
"vitest.commandLine": "yarn test",
"vitest.watchOnStartup": true,
"vitest.debugExclude": [
    "<node_internals>/**",
    "**/node_modules/**"
]

Used Package Manager

yarn

Validations

github-actions[bot] commented 6 months ago

Hello @mujevich. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

mujevich commented 6 months ago

I'm not sure how it would be possible to reproduce my local VS setup, outside of providing the vitest settings

StarpTech commented 6 months ago

I have the same issue. Can be reproduced with https://github.com/wundergraph/cosmo Open it from the root and navigate to https://github.com/wundergraph/cosmo/blob/main/cdn-server/cdn/test/cdn.test.ts

mujevich commented 6 months ago

Thanks a ton for that @StarpTech !!

ffMathy commented 6 months ago

I have a strong feeling this will become way better after #253 is merged.

mujevich commented 6 months ago

Also potentially related to #285, when I restarted my app I did see a similar error

image

sheremet-va commented 6 months ago

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

If you still have the issue, please open a new issue with a reproduction.

StarpTech commented 6 months ago

pre-release 0.5.0 is not available on the marketplace.

sheremet-va commented 6 months ago

pre-release 0.5.0 is not available on the marketplace.

https://marketplace.visualstudio.com/items?itemName=vitest.explorer

Screenshot 2024-03-15 at 20 40 49
StarpTech commented 6 months ago

Hi, I tested pre-release 0.5.0 and it is still not functional. I also upgraded to vitest 1.4.0 and reload vscode

If you still have the issue, please open a new issue with a reproduction.

Why should we open another one if this issue has not been solved?

image

sheremet-va commented 6 months ago

In your case, the problem is the monorepo structure. You define workspace configurations for your pnpm workspace, but you don't do the same for Vitest workspace - I would recommend adding a vitest.workspace file to improve performance of Vitest, at least: https://vitest.dev/guide/workspace.html

There are other issues at play that I will push the fix for (Released in 0.5.3), but I would strongly recommend adding a workspace configuration.

StarpTech commented 6 months ago

Hi, I have defined a workspace file but it still doesn't work.

export default ['controlplane', 'shared', 'cli', 'composition'];
StarpTech commented 6 months ago

It worked. I also had to install vitest in the root. Thank you.