feat(lsp): add "Debug" code lens for test steps#34742
Merged
Merged
Conversation
The LSP emits "▶ Run Test" / "Debug" code lenses above `Deno.test` calls (via the `deno.client.test` command), but test steps only had the native test-explorer gutter "play" button, which can run a step but not debug it. Make `DenoTestCollector` descend into test bodies and emit the same "Run Test" / "Debug" code lenses for each `t.step(...)` call (including destructured `step(...)` and BDD `it(...)` inside `describe(...)`), mirroring the static step detection in `cli/lsp/testing/collectors.rs`. Because `deno test --filter` only matches top-level test names, each step's lens filters by the enclosing top-level test name, so "Debug" on a step runs its parent test under the inspector — the same test the gutter "play" button runs, but now with the debugger attached. Closes #21664 Co-Authored-By: Divy Srivastava <[email protected]>
divybot
added a commit
to divybot/deno
that referenced
this pull request
Jun 3, 2026
Contributor
Author
|
Here's the new Run Test | Debug code lens working on test steps, captured in browser-based VS Code (official Deno extension) driving this PR's Every Clicking Debug on a step runs its enclosing top-level test under the inspector (since |
This was referenced Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The LSP emits "▶ Run Test" / "Debug" code lenses above
Deno.testcalls (resolved by thedeno.client.testcommand in the VS Code extension), but test steps only had the native test-explorer gutter "play" button — which can run a step but not debug it. This is the gap described in #21664.Change
DenoTestCollector(incli/lsp/code_lens.rs) now descends into test function bodies and emits the same "▶ Run Test" / "Debug" code lenses for each test step:t.step(...)on the test context, including arbitrarily nested stepsstep(...)(e.g.Deno.test("t", ({ step }) => …))it(...)/it.only|ignore|skip(...)insidedescribe(...)The step-detection logic mirrors the static collector in
cli/lsp/testing/collectors.rs(which already powers the test-explorer tree), reusing itsparse_test_context_paramhelper.Why filter by the parent test name
deno test --filtermatches top-level test names only (TestFilter::includesis applied per top-level test; steps always run with their parent). So each step lens filters by its enclosing top-level test name. "Debug" on a step therefore runs its parent test under the inspector — exactly the same test the gutter "play" button already runs, but now with the debugger attached and the user free to set a breakpoint inside the step.Top-level code lens output is unchanged (the existing
test_deno_test_collectorunit test andlsp_code_lens_testintegration test are untouched).Tests
Added unit tests in
cli/lsp/code_lens.rscoveringt.step, destructuredstep, and BDDitsteps. Run withcargo test -p deno --lib lsp::code_lens.Closes #21664
Closes denoland/divybot#436