diff --git a/src/Codeception/Subscriber/Console.php b/src/Codeception/Subscriber/Console.php index ba54264eaf..1a7b6c3872 100644 --- a/src/Codeception/Subscriber/Console.php +++ b/src/Codeception/Subscriber/Console.php @@ -356,8 +356,23 @@ public function printFail(FailEvent $e) $this->output->write($e->getCount() . ") "); $this->writeCurrentTest($failedTest, false); $this->output->writeln(''); + + // Clickable `editorUrl`: + if (isset($this->options['editorUrl']) and is_string($this->options['editorUrl'])) { + $filePath = codecept_absolute_path(Descriptor::getTestFileName($failedTest)); + $message = str_replace('%%file%%', $filePath, $this->options['editorUrl']); + $line = 0; + foreach ($fail->getTrace() as $trace) { + if (isset($trace['file']) and $filePath === $trace['file'] and isset($trace['line'])) { + $line = $trace['line']; + } + } + $message = str_replace(['%%file%%', '%%line%%'], [$filePath, $line], $this->options['editorUrl']); + } else { + $message = codecept_relative_path(Descriptor::getTestFullName($failedTest)); + } $this->message(" Test ") - ->append(codecept_relative_path(Descriptor::getTestFullName($failedTest))) + ->append($message) ->write(); if ($failedTest instanceof ScenarioDriven) {