orion0616 opened a new pull request, #3466:
URL: https://github.com/apache/maven-surefire/pull/3466
Since 3.6.0-M1 the JUnit Platform provider re-applies
`<includes>`/`<excludes>`
(and `-Dtest`) as a class name filter, but matched the scanner style patterns
against the dot separated class name. An include with a package directory and
`**/` such as `com/example/it/**/*IT.java`, or a `%regex[...]` include, never
matched, so the classes the plugin had already scanned were dropped again
inside
the fork and the build stayed green with `Tests run: 0`.
This change asks the same `TestListResolver` the plugin builds for its
directory
scanner, about the class file path (`pkg/Name.class`), so the provider can no
longer reject a class the scanner selected, and the hand-written matching
helpers go away. As a consequence `%regex[...]` is evaluated against the
`.class` path as documented, Ant style and regex includes are alternatives of
one filter instead of two filters that both had to match,
`-Dtest=!Class#method`
excludes only that method, and the default exclude `**/*$*` takes effect in
the
provider (it does not affect `@Nested` classes, which Jupiter never passes
through a `ClassNameFilter`). The enclosing classes of scanned nested classes
stay included as before (#3446), now for excludes as well as for includes.
The new IT covers a package directory include with `**/`, a `**/dir/**/`
include, a `%regex[...]` include and a package directory exclude; three of
the
four fail on master. Unit tests cover the pattern shapes the provider
receives
from the plugin, including the `-Dtest` forms, `!` negation, includes
combined
with excludes and the enclosing class of a scanned nested class.
Fixes #3465
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Each commit in the pull request should have a meaningful subject line
and body.
- [x] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [x] Run `mvn clean install` to make sure basic checks pass. A more
thorough check will
be performed on your pull request automatically.
- [x] You have run the integration tests successfully (`mvn -Prun-its clean
install`).
Validation performed with JDK 17:
- `mvn -nsu -Dmaven.build.cache.enabled=false clean install`
(17-module reactor, 1481 unit tests; Spotless, Checkstyle, RAT and
animal-sniffer pass)
- `mvn -Prun-its -pl surefire-its -Dit.test=Surefire3465IT clean verify`
(fails on master, passes with this change)
- `mvn -nsu -Dmaven.build.cache.enabled=false -Prun-its clean install`
(17-module reactor; 780 integration tests, 0 failures, 0 errors)
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January
2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor
License Agreement](https://www.apache.org/licenses/icla.pdf).
--
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]