Skip to content

CodeLens missing and individual method execution freezes on @Nested JUnit 6 classes (macOS) #1897

Description

Type: Bug

When using @Nested test classes in JUnit 5 (with Spring Boot @DataJpaTest / Testcontainers), the extension fails to render CodeLens buttons for inner classes and freezes when running individual nested test methods from the Test Explorer.

Environment

  • OS: macOS (zsh)
  • VS Code Extension: Test Runner for Java (vscjava.vscode-java-test)
  • Framework: Spring Boot + JUnit 5 + Testcontainers

Steps to Reproduce

  1. Create a main test class annotated with @DataJpaTest and @Import(TestcontainersConfiguration.class).
  2. Create inner classes annotated with @Nested and @DisplayName.
  3. Open the file in VS Code.

Expected Behavior

  1. CodeLens ("Run | Debug") should appear above @Nested inner classes and their @Test methods.
  2. Running a single @Test method from inside a @Nested class via the Test Explorer panel should execute cleanly.

Actual Behavior

  1. CodeLens buttons are missing above @Nested inner classes.
  2. Triggering a single test method inside @Nested from the Test Explorer hangs/freezes indefinitely (likely due to nested class $ delimiter escaping issues in macOS zsh or context inheritance failures).

Workaround attempted

Adding @NestedTestConfiguration(INHERIT) and setting spring.test.nested.class.execution=INHERIT did not prevent the runner from hanging when selecting individual nested methods.

Extension version: 0.46.0
VS Code version: Code 1.131.0 (e4c7e7b1d6d060162f4aa7f8225271b67ce1df75, 2026-07-28T10:51:25Z)
OS version: Darwin arm64 25.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M1 Pro, Version 26.5.2 (Build 25F84))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.5.2 ACTIVE
Machine model name: MacBookPro
Machine model version: 18.1
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 4, 4, 3
Memory (System) 16.00GB (0.08GB free)
Process Argv --crash-reporter-id 9d2ff9aa-dc31-484a-a943-bcece3ff6fb5
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
pythonvspyt551cf:31249601
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
envsactivate1:31551504
cloudbuttont:31379625
3efgi100_wstrepl:31403338
839jf696:31457053
ec5jj548:31422691
cp_cls_t_966_ss:31526232
8hhj4413:31478653
cp_cls_t_1081:31454832
conptydll_true:31498968
e9c30283:31461165
test_treatment2:31471001
c9b86496:31447327
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
chat:31457767
7e187181:31503455
ghj88844:31499326
ddid_c:31478207
hmra_i5g22:31518061
bjc72774_agent_sandbox:31557830
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_t_632:31543129
748c7209:31512887
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
f9bf7985:31543584
jh5f2457_c:31540921
41836166:31537719
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_t_nes:31548657
jf4hg949:31526829
ahp-both-windows:31556933
h561g132:31533256
sessions_3:31532893
ihg5j128:31534457
f412h606:31551416
7g2b5551:31542111
sandbox-ui-on-2:31543161
5fe6f778:31554331
allow-none:31555437
fd5dc207:31551400
c7c27ce7:31554789
8hc4g144:31558143
0dg73464:31554319
treatment-23-1:31555779
unuse_dynamic_mcp:31555281
session-archive:31558132

Activity

  1. github-actions commented on Aug 3, 2026

    @github-actions

    Hi James Ovalle (@JimmyRampage), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

  2. wenytang-ms commented on Sep 28, 2026

    @wenytang-ms
    Contributor

    Thanks for reporting this. The missing CodeLens issue should be addressed by #1910.

    I also created a reproduction project based on your description and tested it on Windows with the current extension source, including that fix:

    • JUnit 5.12.2 / Spring Boot 3.5.0 and JUnit 6.0.1 / Spring Boot 4.0.1.
    • Package-private, non-static @Nested classes with @DisplayName, both plain JUnit tests and @DataJpaTest tests using H2.
    • Running an individual nested method, the nested class, and the outer class through the extension's Test Explorer execution path.

    All 12 execution checks passed, and selecting an individual method ran only that method. Nested classes and methods were also discovered correctly. I could not reproduce the hang in these scenarios. This does not rule out your issue: I have not verified macOS-specific behavior or successful Testcontainers execution with a running Docker engine. With Docker unavailable locally, the container tests returned an explicit error rather than hanging.

    Could you retry with a build containing #1910 and up-to-date Java language support and Java Debug extensions? If it still hangs, please capture the logs first, then try Java: Clean Java Language Server Workspace from the Command Palette and let the project finish importing and building before retrying. This is a troubleshooting step, not a confirmed fix. In my local setup, stale build errors caused Java Debug to wait for a "Build failed, do you want to continue?" prompt; a full workspace rebuild cleared that condition. Please also check for pending build-error prompts and confirm that Docker is running.

    If the issue persists, please share:

    • A minimal reproduction project
    • The logs from Java: Open All Log Files captured after reproducing the issue
    • The Test Runner for Java output and Debug Console output
    • The exact JUnit, Spring Boot, Testcontainers, JDK, and Java extension versions (the title mentions JUnit 6, while the description mentions JUnit 5)
    • Whether the same individual nested method runs successfully with Maven or Gradle outside VS Code

    This will help us distinguish a test discovery/launch problem from a project build, Spring context, or container startup issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions