Open SJrX opened 6 years ago
I did some digging and was hoping to submit a PR to fix it however I have given up. Here is what I found:
ScalaTestAction.groovy
doesn't pass the W option to the scalatest runner, unless the ConsoleOutput reported by getConsoleOutput()
is Plain. When I run the value is Auto. Looking at the ConsoleOutput Gradle Doc says
Auto Enable color and rich output when the current process is attached to a console, disable when not attached to a console.
To me this means, that we need to check whether or not the current process is attached to the console. The way to check this seems to be System.console()
Returns the unique Console object associated with the current Java virtual machine, if any. Returns The system console, if any, otherwise null.
However this does not work, it is always null when I run thus never sending the console.
I decided to dig into what Gradle is doing, it seems that ConsoleConfigureAction.getConsoleMetaData() line 73 returns the console if it's detected, and the code for that is here in NativePlatformConsoleDetector.getConsole().
However even if i use the same library (net.rubygrapefruit), I don't seem to ever get a true, when running normally so I'm not sure how to detect it, or how Gradle even deals with it.
Part of me wonders if this really should just be scalatest's job and that it should just clean up it's output if it's inappropriate.
Thanks - yes, a tricky question.
I think that the Gradle Plugin for IntelliJ should probably state that it requires plain text output, or should provide a terminal that can handle coloured output?
Not that this answers the eternal question posed by #67 ... I have been meaning to investigate using the JUnit reporter to integrate more tightly with Gradle's test frameworks, but I struggle to find the time to scratch the itch. Personally I find it straightforward to launch a build from the Terminal.
You could add -W
parameter for now:
https://www.scalatest.org/user_guide/using_the_runner#configuringReporters
W - without color
You could add
-W
parameter for now: https://www.scalatest.org/user_guide/using_the_runner#configuringReportersW - without color
How can I config it in gradle.build
? Or where should I config in IDE?
You can't add the -W
parameter yourself.
I think you need to ask the IDE team to fix it.
You might try to use the information at https://docs.gradle.org/current/userguide/build_environment.html and configure your personal gradle.properties
to have
org.gradle.console=plain
I noticed when I added your plugin to IntelliJ that I wasn't seeing tests (like in #67), however I also noticed that that even in the Gradle log the output was corrupted with ASCII control characters.
build.gradle
src/test/Test.scala
If I run
./gradlew test
I getIf I run
./gradlew test | less
(piping through less).Intellij Is about the same.