Return unresolved when tests not found during discovery #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have a project that has both java and scala tests in a multimodule maven project and we use junit5 to run all of them. We also use IntelliJ and this causes problems. When running tests on a whole module the ScalaTestEngine fails with an error at the bottom. As you can see it tries to discover tests using classpath root and IntelliJ, besides a test classes path adds a normal classes path. Obviously, there are no tests to discover there so when
Resolution.matches
is called at the end ofresolve
with an empty set it fails an assertion. Looking at other code for junit test engines it seems it should returnResolution.unresolved()
to indicate that nothing was found. (see https://junit.org/junit5/docs/current/api/org.junit.platform.engine/org/junit/platform/engine/SelectorResolutionResult.Status.html).To fix it I just applied a simple condition to check if the results are empty and return
unresolved
in such a case. I have also reduced log verbosity since it logs something that looks like debugging messages (at least I found it superfluous when they appeared in my test logs).