fix(run): let Maven reactor modules without the selected tests pass in every test run (#4845)

In a Maven multi-module project, Rerun Failed Tests and Run on a test file failed before the selected tests ran: -Dtest reached the first module without a matching test and Surefire stopped the build, skipping the module with the test. Those two paths built -Dtest themselves without -Dsurefire.failIfNoSpecifiedTests=false; every Maven test selection now goes through withMavenTests, which replaces an earlier -Dtest and always adds the flag.

Co-authored-by: ntbang0901 <121003585+ntbang0901@users.noreply.github.com>

Co-authored-by: ntbang0901 <121003585+ntbang0901@users.noreply.github.com>
This commit is contained in:
ntbang0901
2026-11-20 23:44:02 +08:00
committed by GitHub
parent 1d857375dc
commit 4f192a12bc
9 changed files with 44 additions and 16 deletions
+6 -1
View File
@@ -261,7 +261,12 @@ describe("application configurations", () => {
});
it("scopes Maven and Gradle test configs to a class or method", () => {
const file = cfg({ id: "f", kind: "maven", args: ["test", "-Dtest=OrderTest"], isTest: true });
const file = cfg({
id: "f",
kind: "maven",
args: ["test", "-Dtest=OrderTest", "-Dsurefire.failIfNoSpecifiedTests=false"],
isTest: true,
});
expect(jvmTestConfig(file, "a.OrderTest$Nested", "fails")).toMatchObject({
name: "Nested.fails",
args: ["test", "-Dtest=a.OrderTest$Nested#fails", "-Dsurefire.failIfNoSpecifiedTests=false"],