szpak / gradle-pitest-plugin

Gradle plugin for PIT Mutation Testing
http://gradle-pitest-plugin.solidsoft.info/
221 stars 58 forks source link

Ascii art progress indicator messes up Gradle output #267

Closed C-Otto closed 2 years ago

C-Otto commented 3 years ago

2-:\7|3/ -I\ |>/W-R\I|G/:-M\n|o/ -x\t|d/a-n\rm23:48:42 PIT >> INFO : Completed in 74 seconds / The line above is supposed to contain "WARNING". Over time, while PIT runs, the characters "\|/" are added all over the screen, overwriting existing characters.

Gradle 7 pitestVersion = '1.6.5' junit5PluginVersion = '0.14' implementation 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.6.0'

davidburstrom commented 3 years ago

Unfortunately this is produced by SpinnerListener, which is linked up through MutationCoverage only if the output is not verbose. Since you probably don't want to turn on verbose logging, that creates a conundrum.

One option is to use https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/JavaExec.html#setStandardOutput-java.io.OutputStream- to capture Pitest stdout and only flush complete lines to Gradle stdout. Though the spinner art will not indicate progress, real output from tests will be forwarded in real time.

Alternatively, simply capture all of the output in a buffer and print it in one go at the end of task execution.

And yet another option is to use class-loader shadowing to replace the SpinnerListener with a no-op implementation, but this will all end in tears.

@szpak How do you feel about those options, and what other options do you see?

hcoles commented 3 years ago

This will be addressed in pitest 1.7.1, which adds a new "verbosity" param, with options to enable/disable the spinner and swallow a lot of the noise from the minions.

https://github.com/hcoles/pitest/pull/934