diff --git a/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php b/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php --- a/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php +++ b/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php @@ -115,6 +115,9 @@ } public function run() { + $renderer = $this->renderer; + $this->setRenderer(null); + $paths = $this->getPaths(); // If we are running with `--everything` then `$paths` will be `null`. @@ -122,14 +125,15 @@ $paths = array(); } - $engines = $this->buildTestEngines(); - $results = array(); - $exceptions = array(); + $engines = $this->buildTestEngines(); + $all_results = array(); + $exceptions = array(); foreach ($engines as $engine) { $engine ->setWorkingCopy($this->getWorkingCopy()) - ->setEnableCoverage($this->getEnableCoverage()); + ->setEnableCoverage($this->getEnableCoverage()) + ->setRenderer($renderer); // TODO: At some point, maybe we should emit a warning here if an engine // doesn't support `--everything`, to reduce surprise when `--everything` @@ -140,19 +144,30 @@ try { // TODO: Type check the results. - $results[] = $engine->run(); + $results = $engine->run(); + $all_results[] = $results; + + foreach ($results as $result) { + if ($engine->shouldEchoTestResults()) { + echo $renderer->renderUnitResult($result); + } + } } catch (ArcanistNoEffectException $ex) { $exceptions[] = $ex; } } - if (!$results) { + if (!$all_results) { // If all engines throw an `ArcanistNoEffectException`, then we should // preserve this behavior. throw new ArcanistNoEffectException(pht('No tests to run.')); } - return array_mergev($results); + return array_mergev($all_results); + } + + public function shouldEchoTestResults() { + return false; } private function loadAvailableTestEngines() { diff --git a/src/unit/engine/ArcanistUnitTestEngine.php b/src/unit/engine/ArcanistUnitTestEngine.php --- a/src/unit/engine/ArcanistUnitTestEngine.php +++ b/src/unit/engine/ArcanistUnitTestEngine.php @@ -98,7 +98,7 @@ return $this->enableCoverage; } - final public function setRenderer(ArcanistUnitRenderer $renderer) { + final public function setRenderer(ArcanistUnitRenderer $renderer = null) { $this->renderer = $renderer; return $this; } diff --git a/src/unit/engine/PhutilUnitTestEngine.php b/src/unit/engine/PhutilUnitTestEngine.php --- a/src/unit/engine/PhutilUnitTestEngine.php +++ b/src/unit/engine/PhutilUnitTestEngine.php @@ -221,8 +221,4 @@ return $paths; } - public function shouldEchoTestResults() { - return !$this->renderer; - } - }