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 @@ -7,8 +7,6 @@ private $workingCopy; private $paths = array(); - private $arguments = array(); - private $enableAsyncTests; private $enableCoverage; private $runAllTests; private $configurationManager; @@ -71,24 +69,6 @@ return $this->paths; } - final public function setArguments(array $arguments) { - $this->arguments = $arguments; - return $this; - } - - final public function getArgument($key, $default = null) { - return idx($this->arguments, $key, $default); - } - - final public function setEnableAsyncTests($enable_async_tests) { - $this->enableAsyncTests = $enable_async_tests; - return $this; - } - - final public function getEnableAsyncTests() { - return $this->enableAsyncTests; - } - final public function setEnableCoverage($enable_coverage) { $this->enableCoverage = $enable_coverage; return $this; @@ -98,7 +78,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; - } - } diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php --- a/src/workflow/ArcanistUnitWorkflow.php +++ b/src/workflow/ArcanistUnitWorkflow.php @@ -151,7 +151,6 @@ } else { $this->engine->setPaths($paths); } - $this->engine->setArguments($this->getPassthruArgumentsAsMap('unit')); $renderer = new ArcanistUnitConsoleRenderer(); $this->engine->setRenderer($renderer); @@ -165,13 +164,6 @@ } $this->engine->setEnableCoverage($enable_coverage); - // Enable possible async tests only for 'arc diff' not 'arc unit' - if ($this->getParentWorkflow()) { - $this->engine->setEnableAsyncTests(true); - } else { - $this->engine->setEnableAsyncTests(false); - } - $results = $this->engine->run(); $this->validateUnitEngineResults($this->engine, $results);