diff --git a/src/Plugins/Parallel.php b/src/Plugins/Parallel.php index 94902823..d2509695 100644 --- a/src/Plugins/Parallel.php +++ b/src/Plugins/Parallel.php @@ -127,7 +127,9 @@ private function runTestSuiteInParallel(array $arguments): int $arguments ); - $exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput); + $filteredArguments = $this->processTeamcityArguments($filteredArguments); + + $exitCode = $this->paratestCommand()->run(new ArgvInput(array_values($filteredArguments)), new CleanConsoleOutput); return CallsAddsOutput::execute($exitCode); } @@ -197,4 +199,18 @@ private function runTestSuiteInSeries(array $arguments): array return $this->popArgument('-p', $arguments); } + + /** + * @param string[] $arguments + * @return string[] + */ + public function processTeamcityArguments(array $arguments): array + { + $argv = new ArgvInput; + if ($argv->hasParameterOption('--teamcity')) { + $arguments[] = '--teamcity'; + } + + return $arguments; + } } diff --git a/src/Plugins/Parallel/Paratest/ResultPrinter.php b/src/Plugins/Parallel/Paratest/ResultPrinter.php index e7a1c24d..4a2082a8 100644 --- a/src/Plugins/Parallel/Paratest/ResultPrinter.php +++ b/src/Plugins/Parallel/Paratest/ResultPrinter.php @@ -92,14 +92,13 @@ public function flush(): void {} $this->teamcityLogFileHandle = $teamcityLogFileHandle; } - /** @param list $teamcityFiles */ public function printFeedback( SplFileInfo $progressFile, SplFileInfo $outputFile, - array $teamcityFiles + ?SplFileInfo $teamcityFile, ): void { - if ($this->options->needsTeamcity) { - $teamcityProgress = $this->tailMultiple($teamcityFiles); + if ($this->options->needsTeamcity && $teamcityFile instanceof SplFileInfo) { + $teamcityProgress = $this->tailMultiple([$teamcityFile]); if ($this->teamcityLogFileHandle !== null) { fwrite($this->teamcityLogFileHandle, $teamcityProgress); diff --git a/src/Plugins/Parallel/Paratest/WrapperRunner.php b/src/Plugins/Parallel/Paratest/WrapperRunner.php index 469f2aa6..147cbc60 100644 --- a/src/Plugins/Parallel/Paratest/WrapperRunner.php +++ b/src/Plugins/Parallel/Paratest/WrapperRunner.php @@ -225,7 +225,7 @@ private function flushWorker(WrapperWorker $worker): void $this->printer->printFeedback( $worker->progressFile, $worker->unexpectedOutputFile, - $this->teamcityFiles, + $worker->teamcityFile ?? null, ); $worker->reset(); }