private function extractFail($output)
    {
        if (preg_match('%##teamcity\[testFailed.*\]%', $output, $matches)) {
            preg_match(
                "/##teamcity\\[testFailed.*name='(.*)' message='(.*)' details='\\s*(.*)' flowId=.*/",
                $output,
                $matches
            );
            $matches = $this->replaceEscapedChars($matches);
            $fail = sprintf(
                'Test Name: %s' . PHP_EOL . 'Failure Message: %s' . PHP_EOL . 'Trace:' . PHP_EOL . '%s',
                $matches[1],
                $matches[2],
                $matches[3]
            );
            return $fail;
        }
        return 'No failure output was detected by Humbug, but a failure was reported by PHPUnit.';
    }