jest-community / vscode-jest

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

Starting debugging from vscode -jest navigation panel fails with error item orta.vscode-jest: [project] is not debuggable #1056

Closed gbraven-dev closed 1 month ago

gbraven-dev commented 1 year ago

Debugging can be initiated from the vscode debug panel using the vscode-jest launch configuration and can also be initiated from the inline markup in the test files but the extension's own navigation panel fails to initiate debugging with the error "item orta.vscode-jest: [project] is not debuggable". This error did not occur on this project when the extension was first installed.

Environment

  1. vscode-jest version: 6.0.1
  2. node -v: 18.17.1
  3. npm -v or yarn --version: 9.6.7
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected): 29.6.2
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? [fill]
    • jest.autoRun? [fill]
    • anything else that you think might be relevant? [fill]
  6. Operating system: Windows 11

Prerequisite

Steps to Reproduce

[fill]

Relevant Debug Info

[fill]

Expected Behavior

[fill]

Actual Behavior

[fill]


The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

connectdotz commented 1 year ago

Hmmm... if I understand your use case correctly, you were trying to debug from the TestExplorer's tree, right? This error indicated you were trying to debug from a workspace root, it seems, which should not be debuggable - only the test-file, test/describe blocks are debuggable.

Do you have a sample repo so we can take a closer took?

gbraven-dev commented 1 year ago

I apologize but I do not have a repository I can share.

From the vscode testing explorer tree (panel labeled "Testing" that pops open when you click on the testing extension shortcut) at the top there are 3 exposed buttons: Run Tests, Debug Tests, Show Output.

Run Tests --> All of my tests are successfully run Debug Tests --> Get error mentioned in issue report shown in Terminal

If I expand the tree and navigate to an individual test file or to an individual test in that file and click its debug button it works.

If I launch the debug configuration configured for Jest from the main debug panel it works.

If I click on the interactive button overlays displayed when I open a test file in the an editor debugging works.

Just that top level "Debug Tests" fails.

Clearly not a showstopper of any kind for me. Just thought I would report in case it needs fixing.

connectdotz commented 1 year ago

I see, thanks for bringing it to our attention. This is the intended behavior though, maybe the message can be improved.

To debug from the root item means to run all tests for otherwise a single test block debugging, i.e. not very efficient. Therefore we disabled the root/directory level debugging, to encourage the adoption of more efficient debug runs.

Dose that make sense?

gbraven-dev commented 1 year ago

Understood. User could choose to run all tests in debug mode for an explicit reason...so maybe letting user determine efficiency is optimal. For current implementation would just say the button should probably be disabled for clarity and would find a way to keep the error message from being generated so it doesn't cause confusion. Although these are very low severity/priority.

connectdotz commented 1 year ago

That's true, we should either enable and support debug for all situations, or disable the button altogether.

sailingKieler commented 1 year ago

That's true, we should either enable and support debug for all situations, or disable the button altogether.

+1