vitest-dev / vscode

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

setupFile.mjs not found #356

Closed PandharabaleAniketJohnDeere closed 4 months ago

PandharabaleAniketJohnDeere commented 4 months ago

Describe the bug

After the Vitest extension update (0.8.1), when I run the tests in VSCode, I get following error: Failed to load url C:/Users/IKFP9H5/.vscode/extensions/vitest.explorer-0.8.1/dist/setupFile.mjs (resolved id: C:/Users/IKFP9H5/.vscode/extensions/vitest.explorer-0.8.1/dist/setupFile.mjs). Does the file exist?

I can see the file located in the file structure. But tests are not running in VSCode.

Reproduction

Update/Install the Vitest extension for VSCode. Name: Vitest Id: vitest.explorer Description: A Vite-native testing framework. It's fast! Version: 0.8.1 Publisher: Vitest VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=vitest.explorer

Output

Failed to load url C:/Users/IKFP9H5/.vscode/extensions/vitest.explorer-0.8.1/dist/setupFile.mjs (resolved id: C:/Users/IKFP9H5/.vscode/extensions/vitest.explorer-0.8.1/dist/setupFile.mjs). Does the file exist?

Version

0.8.1

Validations

github-actions[bot] commented 4 months ago

Hello @PandharabaleAniketJohnDeere. 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.

guysympoly commented 4 months ago

Hi, the same thing happens to me, here's a log of the error I receive

[INFO 4:04:25 PM] [v0.8.1] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace.
[INFO 4:04:27 PM] [API] Running Vitest: v1.5.0 (vitest.config.ts)
[INFO 4:04:27 PM] [API] Starting Vitest process with Node.js: C:\Program Files\nodejs\node.EXE
[Error 4:04:31 PM] [Error Error] Vitest failed to start: 

r
Error: Vitest failed to start: 

r
    at ChildProcess.u (c:\Users\*****\.vscode\extensions\vitest.explorer-0.8.1\dist\extension.js:13:331)
    at ChildProcess.emit (node:events:517:28)
    at emit (node:internal/child_process:944:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

I'm running vitest in a project using pnpm (idk if that actually matters), and I managed to make the extension work only by rolling back to an earlier version (0.6.0).

here's my vitest.config.ts

import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
  plugins: [tsconfigPaths(), react()],
  test: {
    environment: "jsdom",
    reporters: ["html"],
    coverage: {
      enabled: true,
    },
  },
});
sheremet-va commented 4 months ago

I can confirm the issues is reproducible on Windows.

PandharabaleAniketJohnDeere commented 4 months ago

I deleted the VS Code extension folder (C:/Users/IKFP9H5/.vscode/extensions) and installed Vitest plugin again in VSCode. It is working as expected. This happened with my office colleague too. Maybe some cache issue or something with VSCode.