how to get specs2 color support on windows using m

2019-08-07 02:10发布

问题:

I am using "Git Bash" git's mingw console to run Specs2 tests using SBT on Windows. The mingw console has color support but my specs2 tests do not display in color. How can I get my mingw, sbt, specs2, windows setup to display tests in color?

I tried adding the following options to my build.sbt configuration, but it did not change anything.

testOptions in Test += Tests.Argument("jline.terminal","jline.UnsupportedTerminal")

Thanks

回答1:

I was able to get this working by downloading Cygwin and using the mintty terminal instead of "Git Bash", along with the following script. However while this gained me color for specs2 I lost color for git. But at least I have a resizable terminal now.

#!/bin/sh

#must be saved with unix line endings
#setup for using sbt with cygwin's mintty terminal (gets you colored specs2 tests)

BASEDIR=$(dirname $0)
stty -icanon min 1 -echo > /dev/null 2>&1
java -Djline.terminal=jline.UnixTerminal -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar `cygpath -m $BASEDIR/sbt-launch.jar` "$@"
stty icanon echo > /dev/null 2>&1