vscode-jest-runner icon indicating copy to clipboard operation
vscode-jest-runner copied to clipboard

Error with template literal index

Open UnleashSpirit opened this issue 7 months ago • 1 comments

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)

UnleashSpirit avatar Dec 22 '23 15:12 UnleashSpirit

i think its just missing the escaping for this character.

firsttris avatar Feb 20 '24 07:02 firsttris