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
264 stars 124 forks source link

GitLens V12.0.1+ breaks Jest Runner debugging #272

Open Sam-Kearns opened 2 years ago

Sam-Kearns commented 2 years ago

This issue is a cross post from GitLens. I don't know which project is responsible for the issue.

Description

Environment:

My user/settings.json contains only one line required for Jest Runner. Everything else has been temporarily removed while investigating this bug.

{
    "jestrunner.codeLensSelector": "**/*.{spec}.{js,jsx,ts,tsx}",
}

Expected Jest Runner behaviour:

  1. Ensure GitLens is disabled or not installed
  2. Place a breakpoint in a Node.js source file that has a Jest test
  3. Go to the Jest test file and click Jest Runners "debug" lens button
  4. Observe that Jest Runner opens a new terminal tab and executes a "cd to project base dir" command
  5. Then an additional output tab opens in the terminal panel called "Debug Jest Tests" with the "debug" icon next to the name. The command to launch the test in debug mode appears in this terminal, plus all test output.
  6. Observe that VS Code debug mode begins, the floating debug control bar appears, code execution is halted at the breakpoint, the Run & Debug panel is populated with process information.

Bug Reproduction:

  1. Install and enable GitLens V12.0.1+
  2. Go to the Jest test file and click Jest Runner's "debug" lens button again.
  3. Observe that Jest Runner opens a new terminal tab and executes a "cd to project base dir" command
  4. Observe that the additional "Debug Jest Tests" output tab never appears and the command to launch the test in debug mode never appears. No test output of any sort is observed anywhere.
  5. Observe that VS Code debug mode begins, the floating debug control bar appears, but code execution never begins and the Run & Debug panel remains blank. The "spinner" animation at the top of the Run & Debug window spins indefinitely, presumably waiting to connect to my code's process that wasn't launched.

Bug Fix:

  1. Install and enable GitLens V12.0.0 and restart VS Code
  2. Observe that the expected Jest Runner behaviour is restored

Additional Observation: When GitLens V12.0.1+ is installed and enabled, the "activity spinner" animation at the top of the VS Code Extensions panel never stops spinning, no matter how long VS Code is open. This does not occur with GitLens V12.0.0 or below.

While trying to find the exact version that introduced the bug I tried several GitLens versions. The bug was reproduced in the following GitLens versions

Bug was NOT reproducible, and Jest Runner debug worked as expected, on these GitLens versions

VS Code Version

Version: 1.71.0 Commit: 784b0177c56c607789f9638da7b6bf3230d47a8c Date: 2022-09-01T07:25:38.437Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin x64 21.6.0 Sandboxed: No

Git Version

git version 2.32.1 (Apple Git-133)

firsttris commented 1 year ago

seems like this is more a problem with GitLens then a problem with vscode-jest-runner?

Sam-Kearns commented 1 year ago

I suspect so, which is why I opened the issue on GitLens first, but I don't know.

I opened this issue in case someone here might have some insight that would help determine the root cause cause one way or the other. GitLens is very popular so I was assuming that there might be a significant number of JestRunner users having this problem.

I am OK with closing this issue here for now in the hope that the issue will be addressed by GitLens.

firsttris commented 1 year ago

You can leave it open no problem