firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
265 stars 124 forks source link

Error with template literal index #349

Open UnleashSpirit opened 8 months ago

UnleashSpirit commented 8 months ago

Hello,

I love this plugin that offer a simple way to "Run | Debug" a test generating directly correct command line :) I often used it.each and template literal like this

it.each`
  a    | b
  ${1} | ${2}
  ${1} | ${2}
`('Test $a $b', ({ a, b }) => {
  [...]
});

the problem is when I want to used index, $#, the generated command line not working.

It generates

[...] -t "EcheancesDelais_BoutonPaiementComponent \$# Test (.*?) (.*?)"

The \$# not matches anything and tests are skipped

The workaround for now is to modify the command line with (.+?) (very simple way)

[...] -t "EcheancesDelais_BoutonPaiementComponent (.+?) Test (.*?) (.*?)"

    √ 0 Test 1 2 (132 ms)
    √ 1 Test 1 2 (9 ms)

It would be great if the plugin can manage this template literal index $# (which is %# in array each execution)

firsttris commented 6 months ago

i think its just missing the escaping for this character.