vitest-dev / vscode

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

Vitest fails to start if a compiled config is available #422

Closed bennycode closed 2 weeks ago

bennycode commented 2 weeks ago

Describe the bug

The Vitest VS Code extension fails to start when a compiled Vitest config is available.

Reproduction

  1. Put a Vitest TypeScript config (vitest.config.ts) in the root of your project
  2. Compile the config using tsc so that a dist/vitest.config.d.ts file is being created
  3. Reload the VS Code window to see if the VS code extension can be initialized (it will crash)

Current workaround: Deleting the dist/vitest.config.d.ts file and reloading the VS code window resolves the issue.

Output

[INFO 1:12:50 PM] [v0.12.3] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 1:12:51 PM] [API] Running Vitest v1.6.0 (dist/vitest.config.js) with Node.js: /home/bennycode/.nvm/versions/node/v20.10.0/bin/node
[INFO 1:12:51 PM] [API] Running Vitest v1.6.0 (dist/vitest.config.d.ts) with Node.js: /home/bennycode/.nvm/versions/node/v20.10.0/bin/node
[INFO 1:12:51 PM] [API] Running Vitest v1.6.0 (trading212-api/vitest.config.ts) with Node.js: /home/bennycode/.nvm/versions/node/v20.10.0/bin/node
[INFO 1:12:52 PM] [API] Vitest v1.6.0 (dist/vitest.config.js) process 25764 created
[INFO 1:12:52 PM] [API] Vitest v1.6.0 (trading212-api/vitest.config.ts) process 25771 created
[Worker] failed to load config from /home/bennycode/dev/bennycode/trading212-api/dist/vitest.config.d.ts
[Error 1:12:52 PM] [Error Error] Vitest failed to start: 
Error: Vitest failed to start: 
    at ChildProcess.f (/home/bennycode/.vscode-server/extensions/vitest.explorer-0.12.3/dist/extension.js:18:5392)
    at ChildProcess.emit (node:events:518:28)
    at emit (node:internal/child_process:951:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Version

v0.12.3

Validations