Repository navigation
CodeLens missing and individual method execution freezes on @Nested JUnit 6 classes (macOS) #1897
Description
Activity
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.
-
The Test Runner for Java currently does not show CodeLens for classes that only contain
@Nestedinner classes by design. See:- The class which only contains nested classes can’t show code lens (no fix planned): The class which only contains nested classes can't show code lens #720 (comment)
-
The hang when running an individual nested test method on macOS is a known issue. Please follow progress here:
- Individual Tests Hang on Run Test: Resolving launch configuration… (macOS): Individual Tests Hang on Run Test: Resolving launch configuration... #1288
Other references with low confidence
- Running an outer class test will cause the previous inner class state CodeLens to disappear (Windows, CodeLens flicker): Running an outer class test will cause the previous inner class state CodeLens to disappear #740
- Nested tests in JUnit 6 cause JUnit 5 error (mixed-engine config issues): Nested tests in JUnit 6 cause JUnit 5 error #1838
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!
-
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
@Nestedclasses with@DisplayName, both plain JUnit tests and@DataJpaTesttests 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.
Reacted by issuelens
Type: Bug
When using
@Nestedtest 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
vscjava.vscode-java-test)Steps to Reproduce
@DataJpaTestand@Import(TestcontainersConfiguration.class).@Nestedand@DisplayName.Expected Behavior
@Nestedinner classes and their@Testmethods.@Testmethod from inside a@Nestedclass via the Test Explorer panel should execute cleanly.Actual Behavior
@Nestedinner classes.@Nestedfrom the Test Explorer hangs/freezes indefinitely (likely due to nested class$delimiter escaping issues in macOSzshor context inheritance failures).Workaround attempted
Adding
@NestedTestConfiguration(INHERIT)and settingspring.test.nested.class.execution=INHERITdid 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
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
A/B Experiments