Skip to content
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

JUnit 5: Impossible to override junit.platform.output.capture.stdout.* configurations #292

Open
RomanVlasenko opened this issue Jul 25, 2024 · 0 comments

Comments

@RomanVlasenko
Copy link

Runner for JUnit 5 tests java/src/com/github/bazel_contrib/contrib_rules_jvm/junit5/ActualRunner.java (source) contains the following lines:

...
LauncherDiscoveryRequestBuilder request =
  LauncherDiscoveryRequestBuilder.request()
      .selectors(classSelectors)
      .configurationParameter(LauncherConstants.CAPTURE_STDERR_PROPERTY_NAME, "true")
      .configurationParameter(LauncherConstants.CAPTURE_STDOUT_PROPERTY_NAME, "true")
      .configurationParameter(
          Constants.EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME, "true");
...

Unfortunately, it's impossible to override these settings, according to JUnit 5 documentation (source):

Configuration parameters are looked up in the exact order defined above. Consequently, configuration parameters supplied directly to the Launcher take precedence over those supplied via custom configuration files, system properties, and the default configuration file. Similarly, configuration parameters supplied via system properties take precedence over those supplied via the default configuration file.

Having these settings in place results in pollution of the test output, which can be quite annoying.

Would it be possible to remove hardcoded settings with LauncherConstants.CAPTURE_STDERR_PROPERTY_NAME and LauncherConstants.CAPTURE_STDOUT_PROPERTY_NAME or make them configurable via Bazel target attributes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant