Skip to content

feat: junit 6 support - #1820

Merged
wenyt (wenytang-ms) merged 6 commits into
mainfrom
wenyt/dd1
Dec 4, 2025
Merged

feat: junit 6 support#1820
wenyt (wenytang-ms) merged 6 commits into
mainfrom
wenyt/dd1

Conversation

@wenytang-ms

@wenytang-ms wenyt (wenytang-ms) commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

This is just the initial version that supports JUnit 6, and compatibility is not being considered for now.
test against with redhat/vscode-java 1.51.2025120208
https://github.com/junit-team/junit-examples/tree/main/junit-jupiter-starter-maven
https://github.com/microsoft/vscode-java-test/tree/main/test/test-projects/junit

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds JUnit 6 support to the Java test runner extension, extending the framework to handle the next major version of JUnit Jupiter. The implementation follows the existing JUnit 5 pattern by adding a new TestKind enum value and implementing corresponding searcher and finder classes.

Key Changes:

  • Added JUnit6 enum value to TestKind across TypeScript and Java codebases
  • Implemented JUnit6TestSearcher and JUnit6TestFinder classes for test detection
  • Updated conditional logic throughout to handle JUnit 6 alongside JUnit 5
  • Updated dependencies to include JUnit 6 artifacts (versions 6.0.1) and upgraded JUnit 5 to 5.14.x
  • Modified build scripts to support multiple JUnit versions and updated Eclipse platform target

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/java-test-runner.api.ts Added JUnit6 enum value (3) to TestKind
src/utils/launchUtils.ts Extended tag parsing condition to include JUnit6
src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts Added JUnit6 runner package filter and extended display name logic for JUnit6
src/controller/testController.ts Added JUnit6 case to runner selection and test framework version tracking; minor whitespace fix
scripts/buildJdtlsExt.js Updated bundle list with JUnit6 runtime and refactored updateVersion() to rebuild from actual server folder contents
package.json Added JUnit 6 dependencies (6.0.1) and upgraded JUnit 5 to 5.14.1 and platform to 1.14.1
java-extension/.../com.microsoft.java.test.tp.target Updated Eclipse repository URLs to 4.38-I-builds and 2025-12 release
java-extension/.../JUnit6TestSearcher.java New test searcher implementation for JUnit 6 using JUNIT_PLATFORM_TESTABLE annotation
java-extension/.../JUnit6TestFinder.java New test finder implementation with JUnit 6 loader support
java-extension/.../TestFrameworkUtils.java Added JUNIT6_TEST_SEARCHER constant and case in getSearcherByTestKind()
java-extension/.../TestGenerationUtils.java Extended lifecycle annotations handling to include JUnit6
java-extension/.../TestKindProvider.java Added JUnit6 detection using CoreTestSearchEngine.hasJUnit6TestAnnotation()
java-extension/.../TestKind.java Added JUnit6(3) enum value with fromString() and toString() support; formatting improvements
java-extension/.../JUnitLaunchUtils.java Added JUNIT6_LOADER constant and case in getEclipseTestKind()
java-extension/.../JUnitLaunchConfigurationTemplate.java Added projectName attribute to launch configuration template
java-extension/.../JUnitLaunchConfigurationDelegate.java Extended parameter handling condition to include JUnit6
java-extension/.../JUnitLaunchConfiguration.java Added projectName to value map
java-extension/.../META-INF/MANIFEST.MF Added JUnit 6 bundle dependencies and upgraded JUnit 5 versions; includes both 5.14.x and 6.0.1 versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread java-extension/com.microsoft.java.test.plugin/META-INF/MANIFEST.MF
Comment thread package.json
Comment thread java-extension/com.microsoft.java.test.plugin/META-INF/MANIFEST.MF
@wenytang-ms wenyt (wenytang-ms) changed the title feat: junit 6 feat: junit 6 support Dec 4, 2025
* to properly detect tests in JUnit 6 projects.
*
* <p><b>Why this class exists:</b> Eclipse JDT does not yet have built-in support for JUnit 6.
* This is a custom implementation that will be needed until Eclipse JDT adds official JUnit 6 support.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still expect JDT to support JUNIT 6?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there also some issue or PR list for jdtls

I think they should officially support, but currently the junit 6 is still not ready, so I think in java-test, implement such a finder for junit 6.

@wenytang-ms
wenyt (wenytang-ms) merged commit a4f782c into main Dec 4, 2025
4 checks passed
@wenytang-ms
wenyt (wenytang-ms) deleted the wenyt/dd1 branch December 4, 2025 05:03
wenyt (wenytang-ms) added a commit that referenced this pull request Jul 7, 2026
The rolling 'jdtls/snapshots/repository/latest/' snapshot drifted: newer jdt.ls builds inconsistently bundle junit-platform-* jars (currently 1.14.x / jupiter 5.14.x) that conflict with the JUnit 6 (6.0.x) stack the plugin manifest requires, breaking OSGi resolution during 'Build OSGi bundle' (mvnw clean verify).

Pin to 1.55.0.202512042336 (the last snapshot before jdt.ls started bundling junit-platform-*, and the build used when JUnit 6 support landed in #1820). With this pin the entire JUnit stack resolves consistently from the Eclipse 4.38 / 2025-12 platform: JUnit 5 (platform 1.14.1 + jupiter 5.14.1), JUnit 4 (vintage 5.14.1) and JUnit 6 (6.0.1) are all present, so no runtime regression.

Regenerate contributes.javaExtensions accordingly: the 1.14.x/5.14.x bundles now come from Eclipse (1.14.1/5.14.1) instead of jdt.ls (1.14.4/5.14.4); asm 9.9.0. Verified locally: 'npm run build-plugin' -> BUILD SUCCESS and 'git diff --exit-code package.json' is clean after regeneration.
wenyt (wenytang-ms) added a commit that referenced this pull request Jul 8, 2026
* build: pin jdt.ls target platform to fix CI resolution failure

The rolling 'jdtls/snapshots/repository/latest/' snapshot drifted: newer jdt.ls builds inconsistently bundle junit-platform-* jars (currently 1.14.x / jupiter 5.14.x) that conflict with the JUnit 6 (6.0.x) stack the plugin manifest requires, breaking OSGi resolution during 'Build OSGi bundle' (mvnw clean verify).

Pin to 1.55.0.202512042336 (the last snapshot before jdt.ls started bundling junit-platform-*, and the build used when JUnit 6 support landed in #1820). With this pin the entire JUnit stack resolves consistently from the Eclipse 4.38 / 2025-12 platform: JUnit 5 (platform 1.14.1 + jupiter 5.14.1), JUnit 4 (vintage 5.14.1) and JUnit 6 (6.0.1) are all present, so no runtime regression.

Regenerate contributes.javaExtensions accordingly: the 1.14.x/5.14.x bundles now come from Eclipse (1.14.1/5.14.1) instead of jdt.ls (1.14.4/5.14.4); asm 9.9.0. Verified locally: 'npm run build-plugin' -> BUILD SUCCESS and 'git diff --exit-code package.json' is clean after regeneration.

* build: pin jdt.ls target platform to latest

* build: pin pre-release Java tooling

* build: track latest Java pre-release tooling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants