vitest-dev / vscode

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

Regression in `0.6.2`: Unable to debug tests inline #349

Closed ssalbdivad closed 4 months ago

ssalbdivad commented 4 months ago

Describe the bug

I'm trying out migrating to Vitest for the new release. Mostly things went smoothly- I can use the explorer to run my tests inline.

If I try to debug them however, I get a message like Cannot find the file test item for <testName>.

Screenshot 2024-04-16 210238

It looks like it's coming from this error in the runner:

https://github.com/vitest-dev/vscode/blob/cac3d22b3c8c2f79a9cf53243004799e40fd232c/src/runner/runner.ts#L518

If I manually install version 0.6.1, I can hit this breakpoint successfully.

That said, it seems like if I try to run the test multiple times on 0.6.1 it still ends up hanging so there seem to be some other underlying issues.

Update:

I also notice that this test failure only occurs from within the test explorer (trying to use a symbol as a WeakMap key). When I run the same test via the CLI, there is no error at all.

Reproduction

Try to debug a TS test using the inline explorer debugger.

OS: Ubuntu 22.04.4 (WSL) VSCode: 1.89.0-insider

This is my config:

import { fromHere } from "@arktype/fs"
import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from "vitest/config"

export default defineConfig({
    plugins: [tsconfigPaths()],
    test: {
        root: fromHere("..", ".."),
        globalSetup: fromHere("vitest.globalSetup.ts"),
        isolate: false,
        fileParallelism: false
    }
})

VScode settings:

    "vitest.rootConfig": "ark/repo/vitest.config.ts",

Output

[INFO 9:28:14 PM] [API] Vitest process 12606 created
[INFO 9:28:14 PM] [API] Collecting tests: /home/ssalb/2.0/ark/schema/__tests__/unit.test.ts
[Error 9:28:22 PM] Cannot find the file test item for symbol

Version

0.6.2

Validations

disog commented 4 months ago

I'm having the same issue.

sheremet-va commented 4 months ago

Fixed in https://github.com/vitest-dev/vscode/commit/b6461588ead317ab5d7d45c71d3fcb833fab9561