tstangenberg opened a new issue, #3474: URL: https://github.com/apache/maven-surefire/issues/3474
### Affected version 3.6.0 ### Bug description ## Summary When `<includes>` on `maven-surefire-plugin` uses a `%regex[...]` pattern, if *any* class matched by that pattern has zero discoverable JUnit 5 tests, Surefire 3.6.0 silently reports **zero tests for every matched class** — including unrelated classes with real, passing `@Test` methods. No error, no warning, `BUILD SUCCESS`. This works correctly on Surefire 3.5.6 with the exact same configuration — only the plugin version differs. ## Reproduction Minimal repo: https://github.com/42talents/surefire-3.6.0-regex-include-regression Two test classes: - `EmptyTest.java` — a class with no test methods at all (matches the include pattern only by name) - `PlainTest.java` — a normal class with one passing `@Test` pom.xml: ```xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.6.0</version> <configuration> <includes> <include>%regex[.*Test.class]</include> </includes> </configuration> </plugin> ``` ``` mvn test # Surefire 3.6.0 (default): Tests run: 0 mvn test -Dsurefire.version=3.5.6 # Surefire 3.5.6: Tests run: 1, PlainTest passes ``` A GitHub Actions matrix build in the repo (`.github/workflows/repro.yml`) demonstrates this automatically — the 3.5.6 job passes, the 3.6.0 job fails an assertion that `PlainTest` actually ran. ## Expected `PlainTest`'s single test runs and passes, regardless of `EmptyTest`'s presence — matching 3.5.6 behavior. ## Actual `Tests run: 0, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS`. `target/surefire-reports/repro.PlainTest.txt` is never created. ## Environment - Maven Surefire 3.6.0 (broken) / 3.5.6 (working) - JUnit Jupiter 5.14.4, JUnit Platform 1.14.4 - JDK 21 (Temurin) - Provider: `org.apache.maven.surefire.junitplatform.JUnitPlatformProvider` (auto-detected) - Reproduces both forked (`forkCount=1`) and in-process (`forkCount=0`) ## Notes This was discovered as a real-world regression affecting a much larger project (thousands of tests), where it manifested as a partial truncation — some classes ran, later-discovered ones silently didn't. The attached minimal repro isolates the actual trigger to a single empty class breaking the whole batch. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
