Skip to content

Debug specific test filter not applied on Windows #64

Closed
@a-type

Description

Describe the bug
When trying to debug a specific test block, the debug process just runs all tests in the file on Windows with Yarn.

To Reproduce
Steps to reproduce the behavior on the example project:

  1. yarn install
  2. Add a second test block
import { describe, it, expect} from 'vitest';

describe('add', () => {
  it ('1 + 1', () => {
    expect(1 + 1).toBe(2);
  })

  it ('2 + 2', () => {
    expect(2 + 2).toBe(4);
  })
})
  1. Add a breakpoint on line 5, inside the "1 + 1" test
  2. Open the Vitest sidebar and select "Debug test" on "2 + 2"
  3. The breakpoint is hit, indicating "1 + 1" is being run

Expected behavior
When debugging a specific test, I expect to only run that test

Screenshots
If applicable, add screenshots to help explain your problem.
image
Shown above: "2 + 2" is being debugged, but the debugger has broken inside "1 + 1"

The full output for the debug test run:

"C:\Program Files\nodejs\node.exe" .\node_modules\vitest\vitest.mjs test D:/vitest-ext-basic-example/add.test.ts -t ""add 2 + 2"" --api 52918
 DEV  v0.12.10 d:/vitest-ext-basic-example
node_modules/vitest/dist/chunk-vite-node-externalize.464ab3dd.js:10480
      API started at http://localhost:52918
node_modules/vitest/dist/chunk-vite-node-externalize.464ab3dd.js:10480
Could not read source map for file:///d:/vitest-ext-basic-example/@vite/env: ENOENT: no such file or directory, open 'd:\vitest-ext-basic-example\@vite\env.mjs.map'

Environment

(Paste info.txt content generated by the example project)

  • OS: [e.g. macOS] Windows 11
  • VSCode version: 1.69.2
  • Vitest version: 0.12.10
  • Vitest plugin version: v0.2.23 (prerelease)

(filled manually, the setup script does not work on Windows either)

Vitest settings updated
'C:\Users\a-typ\AppData\Local\Programs\Microsoft' is not recognized as an internal or external command,
operable program or batch file.
node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions