vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Debugging a test fails if the name contains parentheses

Open IGx89 opened this issue 3 years ago • 0 comments

Describe the bug If my test name contains parentheses, such as "myMethod() returns false", running the test works but debugging it fails. The reason for that is due to the extension making the following command line call:

node .\node_modules\vitest\vitest.mjs add.test.ts -t "add()"

The -t option accept a test pattern, indicating I believe a regular expression. Parentheses are special characters in a regular expression, and since this extension isn't escaping them the match fails. It should be doing -t "add\(\)" instead.

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

  1. Rename "add" test to "add()"
  2. Debug it.

Expected behavior Test is run in debug mode and breakpoints are hit.

Screenshots No test files found, exiting with code 1

Environment

  • OS: Windows
  • VSCode version: 1.71.2
  • Vitest version: 0.23.2
  • Vitest plugin version: 0.2.29

IGx89 avatar Sep 28 '22 15:09 IGx89