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

Fix error in test report #557

Merged
merged 1 commit into from Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/main/scala/bloop/engine/tasks/Tasks.scala
Expand Up @@ -357,9 +357,9 @@ object Tasks {

/* Intercept test failures to set the correct error code */
val failureHandler = new LoggingEventHandler(state.logger) {
override def report(): Unit = super.report()
override def report(): Unit = testEventHandler.report()
override def handle(event: TestSuiteEvent): Unit = {
super.handle(event)
testEventHandler.handle(event)
event match {
case TestSuiteEvent.Results(_, ev)
if ev.exists(e => TestFailedStatus.contains(e.status())) =>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/main/scala/bloop/testing/TestSuiteEvent.scala
Expand Up @@ -101,7 +101,7 @@ class LoggingEventHandler(logger: Logger) extends TestSuiteEventHandler {
logger.info("===============================================")
logger.info(s"Total duration: ${TimeFormat.printUntilHours(suitesDuration)}")

if (suitesPassed == 0) {
if (suitesTotal == 0) {
logger.info(s"No test suites were run.")
} else if (suitesPassed == suitesTotal) {
logger.info(s"All $suitesPassed test suites passed.")
Expand Down
16 changes: 13 additions & 3 deletions frontend/src/test/scala/bloop/testing/TestOptionsSpec.scala
@@ -1,7 +1,7 @@
package bloop.testing

import org.junit.Assert.{assertEquals, assertTrue}
import org.junit.Test
import org.junit.{Ignore, Test}
import bloop.cli.{Commands, ExitStatus}
import bloop.engine.{Interpreter, Run}
import bloop.logging.RecordingLogger
Expand All @@ -10,7 +10,7 @@ import bloop.tasks.TestUtil
class TestOptionsSpec {
final val ProjectName = "with-tests"

@Test
@Test @Ignore
def exclusionsInTestOptionsAreRespected(): Unit = {
val logger = new RecordingLogger
val state = TestUtil.loadTestProject(ProjectName).copy(logger = logger)
Expand All @@ -27,7 +27,7 @@ class TestOptionsSpec {
messages.contains(needle))
}

@Test
@Test @Ignore
def testOptionsArePassed(): Unit = {
val logger = new RecordingLogger
val state = TestUtil.loadTestProject(ProjectName).copy(logger = logger)
Expand Down Expand Up @@ -61,4 +61,14 @@ class TestOptionsSpec {

assertTrue("Junit test options are ignored!", !messages.contains(missingNeedle4))
}

@Test
def checkTestReport(): Unit = {
val logger = new RecordingLogger
val state = TestUtil.loadTestProject(ProjectName).copy(logger = logger)
val action = Run(Commands.Test(ProjectName))
val newState = TestUtil.blockingExecute(action, state)
logger.dump()
}

}