jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.84k stars 294 forks source link

[BUG] vscode-jest-tests.v2 Debug Configuration does not replace variables when restarting session #1148

Closed tim-helloquickly closed 5 months ago

tim-helloquickly commented 6 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Debug a test with the default v2 configuration
  2. Set a breakpoint and let it stop
  3. Click the "restart" button on the menu bar
  4. See error, command runs but with the litt

Expected behavior Expect the same test to run the same way as the first time: jest --runInBand --watchAll=false --testNamePattern 'redacted$' --runTestsByPath /Users/redacted.test.tsx --testTimeout=100000000 --coverage=false

But the second time around,

jest --runInBand --watchAll=false --testNamePattern '${jest.testNamePattern}' --runTestsByPath '${jest.testFile}' --testTimeout=100000000 --coverage=false

Screenshots Here is an output

Environment (please complete the following information):

Prerequisite

Additional context Add any other context about the problem here.

connectdotz commented 6 months ago

@tim-helloquickly, thanks for bringing this to our attention, I can confirm this is a reproducible bug. I am working with the vscode team to see how we can best resolve it (https://github.com/microsoft/vscode/issues/212005).

connectdotz commented 5 months ago

@tim-helloquickly, I can't seem to be able to reproduce this issue today. Thinking maybe vscode has fixed it already. Can you confirm in your env?

tim-helloquickly commented 5 months ago

I gave it a shot, I can still reproduce -- here is my configuration:

    {
      "type": "node",
      "name": "vscode-jest-tests.v2",
      "request": "launch",
      "args": [
        "test",
        "--watchAll=false",
        "--forceExit",
        "--testNamePattern",
        "${jest.testNamePattern}",
        "--testTimeout=100000000",
        "--runTestsByPath",
        "${jest.testFile}"
      ],
      "cwd": "${workspaceFolder}",
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "runtimeExecutable": "yarn",
      "skipFiles": [
        "<node_internals>/**",
        "${workspaceFolder}/<node_internals>/**",
        "${workspaceFolder}/node_modules/**"
      ]
    },

One thing to note -- if I omit adding a jest configuration to the launch.json and just go with the default, it works properly (so it's specifically the variable substitution

tim-helloquickly commented 5 months ago

I think maybe I was on an outdated version. It works perfectly now!