-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow output directory for JUnitXmlTestsListener to be configured #6425
Conversation
Pull latest changes
Okay, binary compat check failed because the listener no longer has an |
class JUnitXmlTestsListener(val outputDir: String, legacyTestReport: Boolean, logger: Logger) | ||
class JUnitXmlTestsListener(val targetDir: File, legacyTestReport: Boolean, logger: Logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the current API is using String to pass the absolute path around, then we should keep that behavior to minimize the change in case this listener class is extended by others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I've updated to add (another!) legacy constructor which keeps the old API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(To be clear: the current API accepts outputDir
as a String in the constructor, but actually writes to targetDir
which is constructed as ${outputDir}/test-reports
. I believe the new code follows this behaviour as closely as possible)
Thanks for working on this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
LGTM. Could you squash the commits and move some of the descriptions to commit message please? |
Add `testReportsDirectory` setting to allow output directory for JUnitXmlTestsListener to be configured. Add `testReportSettings` which provides defaults values: - by default this uses the build configuration name as a prefix so `target/test-reports` for `Test` config, but `target/it-reports` for `IntegrationTest` (previously this was hardcoded to always use `target/test-reports`). To override this set e.g. `Test / testReportsDirectory := target.value / "my-custom-dir"` - the `JunitXmlTestsListener` is now only attached to the `Test` and `IntegrationTest` configs by default (previously it was added to the global configuration object). Any configs which inherit from one of these will continue to have the listener attached; but completely custom configurations will need to re-add with: `project.settings(testReportSettings)` Fixes sbt#2853
a52c8fc
to
b37fc6d
Compare
Done :) |
* They didn't log they results to console anymore since sbt 1.5.1 -> Caused by sbt/sbt#6425 * Also the total cound of passed/failed tests was not calculated anymore
First draft of a PR for this. Some considerations:
testReportsDirectory
setting to allow this to be set on a per-configuration basistarget/${config.name}-reports
which is a change from the previous behaviour (always defaulted totarget/test-reports
even for e.g. theIntegrationTest
config) - I've added notes about this breaking backwards compatibility but wanted to check this was acceptable? An alternative might be to default totest-reports
?Test
andIntegrationTest
configurations directly, rather than at the global level - again, this breaks compatibility for completely custom configs (NB any config which inherits fromTest
orIntegrationTest
will continue to have the listener, which should cover most cases?)Fixes #2853