vitest-dev / vscode

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

Process doesn't start (Resolving Vitest...) #362

Closed fdc-viktor-luft closed 4 months ago

fdc-viktor-luft commented 4 months ago

Describe the bug

Opening the "Testing" view the process never starts and shows just a spinner on the label "Resolving Vitest..."

Bildschirmfoto 2024-04-22 um 08 12 47

Maybe related: I cannot see any "play" icons in the file view anymore.

Bildschirmfoto 2024-04-22 um 16 07 10

Reproduction

The plugin should tell me why it cannot resolve Vitest.

Could reproduce on this repo as well: https://github.com/fdc-viktor-luft/raw-vite-app

Here is my VSCode About:

Version: 1.88.1
Commit: e170252f762678dec6ca2cc69aba1570769a5d39
Date: 2024-04-10T17:42:52.765Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Darwin x64 23.4.0

Having the same issue under Linux.

Output

[INFO 08:06:39] [v0.8.4] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 07:56:57] [API] Running Vitest: v1.5.0 (vitest.workspace.ts)
[INFO 07:56:57] [API] Starting Vitest process with Node.js: /Users/viktor/.nvm/versions/node/v20.12.0/bin/node

Version

0.8.4

Validations

hi-ogawa commented 4 months ago

From a quick look, your setup file looks a bit suspicious. https://github.com/fdc-viktor-luft/raw-vite-app/blob/baf04e23ae11e403f35246fe7090100c3b2156dc/setupTests.ts#L5-L8 Can you check if commenting out them helps anything?

fdc-viktor-luft commented 4 months ago

The code wasn't the issue. After updating to plugin version 0.8.5 just now, it works in the reproduction repo inside the "Testing" panel. However, the icons still don't appear, and it doesn't work in another project that has a workspace.

Will try to find some time to create a repro with a workspace.

fdc-viktor-luft commented 4 months ago

ok. I made some progress. The issue is highly depending on the amount of workspace packages.

I could only add a maximum of 6 workspace packages into the vitest.workspace.js.

Then I can also see this log:

[INFO 14:16:17] [API] Vitest process 28577 created

Hint: Also my test run icons re-appeared for the added workspace packages. And it doesn't matter which 6 I pick. All work.

The loading takes significantly longer with each added workspace package.

But my current target are 50 workspace packages. However, this never resolves.

sheremet-va commented 4 months ago

But my current target are 50 workspace packages. However, this never resolves.

Is running Vitest from the terminal fast enough with this amount of packages?

fdc-viktor-luft commented 4 months ago

I never tried running the workspace using vitest 🙈 This lead finally to seeing the actual error, while the plugin was not responding at all.

Running vitest run from the workspace level results in the following error:

Error: Project name "typescript" is not unique. All projects in a workspace should have unique names.

And it escapes. The plugin should print that error as well.

After I excluded the duplicates the plugin operates normally with roughly 40 workspace packages.