vitest-dev / vscode

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

Vitest failed to start error on .d.ts files with v0.12.4 #429

Closed bennycode closed 4 months ago

bennycode commented 4 months ago

Describe the bug

I downloaded v0.12.4 because it excludes d.ts config files by default. Unfortunately, it still crashes when opening my workspace.

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)

My vitest.config.ts:

import {defineConfig} from 'vitest/config';

export default defineConfig({
  test: {
    coverage: {
      exclude: ['src/demo'],
      include: ['**/*.{ts,tsx}', '!**/*.d.ts', '!**/cli.ts', '!**/index.ts', '!**/start*.ts'],
      provider: 'v8',
      reporter: ['html', 'lcov', 'text'],
    },
    environment: 'node',
    globals: true,
  },
});

Output

[INFO 9:03:45 AM] [v0.12.4] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 9:03:46 AM] [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 9:03:46 AM] [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 9:03:46 AM] [API] Running Vitest v1.6.0 (dist/vitest.config.js) with Node.js: /home/bennycode/.nvm/versions/node/v20.10.0/bin/node
[Worker] failed to load config from /home/bennycode/dev/bennycode/trading212-api/dist/vitest.config.d.ts
[INFO 9:03:46 AM] [API] Vitest v1.6.0 (trading212-api/vitest.config.ts) process 5536 created
[Error 9:03:46 AM] [Error Error] Vitest failed to start: 

e
Error: Vitest failed to start: 

e
    at ChildProcess.f (/home/bennycode/.vscode-server/extensions/vitest.explorer-0.12.4/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)
[INFO 9:03:46 AM] [API] Vitest v1.6.0 (dist/vitest.config.js) process 5546 created

Version

v0.12.4

Validations