-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print
done
message from test framework to stdout
We are returning the doneMessage from the test framework as value of the test task, but we are not printing it. Moreover, the output is shortcircuited when a task fails, so it's not passed to the `test` command. This PR uses `ctx.log.outputStream.println(doneMessage)` to print the message before returning it so users can clearly see it in case of both success and failure. This was discovered because of the way weaver works on Scala.js Since the `TestRunnerTests` are on `scalalib` and can't use Scala.js code, I implemented two dummy `sbt.testing.Framework`s which just return a fixed `done` message.
- Loading branch information
Showing
5 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
scalalib/test/resources/testrunner/doneMessageFailure/src/DoneMessageFailureFramework.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package mill.scalalib | ||
|
||
import sbt.testing._ | ||
|
||
class DoneMessageFailureFramework extends Framework { | ||
def fingerprints() = Array.empty | ||
def name() = "DoneMessageFailureFramework" | ||
def runner( | ||
args: Array[String], | ||
remoteArgs: Array[String], | ||
testClassLoader: ClassLoader | ||
): Runner = new Runner { | ||
def args() = Array.empty | ||
def done() = "test failure done message" | ||
def remoteArgs() = Array.empty | ||
def tasks(taskDefs: Array[TaskDef]) = Array(new Task { | ||
def taskDef(): TaskDef = null | ||
def execute( | ||
eventHandler: EventHandler, | ||
loggers: Array[Logger] | ||
): Array[Task] = { | ||
eventHandler.handle(new Event { | ||
|
||
override def fullyQualifiedName(): String = "foo.bar" | ||
|
||
override def fingerprint(): Fingerprint = new Fingerprint {} | ||
|
||
override def selector(): Selector = new TestSelector("foo.bar") | ||
|
||
override def status(): Status = Status.Failure | ||
|
||
override def throwable(): OptionalThrowable = new OptionalThrowable() | ||
|
||
override def duration(): Long = 0L | ||
|
||
}) | ||
Array.empty | ||
} | ||
def tags = Array.empty | ||
}) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
scalalib/test/resources/testrunner/doneMessageSuccess/src/DoneMessageSuccessFramework.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package mill.scalalib | ||
|
||
import sbt.testing._ | ||
|
||
class DoneMessageSuccessFramework extends Framework { | ||
def fingerprints() = Array.empty | ||
def name() = "DoneMessageSuccessFramework" | ||
def runner( | ||
args: Array[String], | ||
remoteArgs: Array[String], | ||
testClassLoader: ClassLoader | ||
): Runner = new Runner { | ||
def args() = Array.empty | ||
def done() = "test success done message" | ||
def remoteArgs() = Array.empty | ||
def tasks(taskDefs: Array[TaskDef]) = Array.empty | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters