olamy commented on code in PR #3647:
URL: https://github.com/apache/maven-surefire/pull/3647#discussion_r4734149308
##########
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/lastfailed/LastFailedTestsResolver.java:
##########
@@ -176,12 +181,28 @@ public LastFailedTests resolve(Collection<String>
scannedClasses, TestListResolv
for (String className : wholeClasses) {
tests.addAll(wholeClassPatterns(className, userFilter));
}
+ // Naming a method turns on the fork's method filter, which checks
each test by its own class: next to a
+ // class we run whole, it would leave out its @Nested classes, and the
reports can't always tell us those.
+ // So then we run the class of each failed method whole instead. Not
when -Dtest names methods itself, the
+ // nested classes didn't run with their class in the first place.
+ boolean nameMethods = wholeClasses.isEmpty() ||
userFilter.hasMethodPatterns();
Review Comment:
Thanks for looking. I don't think this one is a bug, though. The rerun keeps
the user's own filter, the `!FooTest$Other` exclude included, and runs
`FooTest` with no method named. That's exactly what
`-Dtest=FooTest,BarTest,!FooTest$Other` does in a normal run. With no method
pattern the fork's method filter is off, and Jupiter doesn't apply the class
name filter to `@Nested` classes, so `FooTest$Other` ran in the first run as
well. The rerun doesn't go beyond what that filter already runs.
An exclude of a `@Nested` class doing nothing when no method is named is a
provider thing that's already on master, so I'd keep it out of this PR.
While I was here, picking the failures now applies an exclude of an
enclosing class to everything nested in it: `!FooTest$Inner` also leaves out
`FooTest$Inner$Deep` (555cf97d4).
--
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]