diff --git a/src/cmake-adapter.ts b/src/cmake-adapter.ts index 6852974..4b1540b 100644 --- a/src/cmake-adapter.ts +++ b/src/cmake-adapter.ts @@ -41,7 +41,8 @@ const ROOT_SUITE_ID = '*'; const SUITE_SUFFIX = '*'; /** Regexp for detecting GCC-like error with file and line info */ -const DECORATION_RE = /^(?:\d+): ([^<].*?):(\d+):\d*:?\s+(?:fatal\s+)?(?:warning|error):\s+(.*)$/ +const DECORATION_RE = + /^([^<].*?):(\d+):\d*:?\s+(?:fatal\s+)?(?:warning|error):\s+(.*)$/; /** * CMake test adapter for the Test Explorer UI extension @@ -342,7 +343,7 @@ export class CmakeAdapter implements TestAdapter { if (!outputs[event.index]) outputs[event.index] = []; outputs[event.index].push(event.line); - const matches = event.line.match(DECORATION_RE) + const matches = event.text?.match(DECORATION_RE); if (matches) { const [, file, line, message] = matches; @@ -351,7 +352,7 @@ export class CmakeAdapter implements TestAdapter { file, line: Number.parseInt(line) - 1, message, - }) + }); } break; diff --git a/src/cmake-runner.ts b/src/cmake-runner.ts index d921e5a..7c6fdcf 100644 --- a/src/cmake-runner.ts +++ b/src/cmake-runner.ts @@ -23,7 +23,7 @@ const CTEST_RE = /^CMAKE_CTEST_COMMAND:INTERNAL=(.*)$/m; const CTEST_START_RE = /^\s+Start\s+(\d+): (.+)/; /** Regexp for test output line */ -const CTEST_OUTPUT_RE = /^(\d+): .*$/; +const CTEST_OUTPUT_RE = /^(\d+): (.*)$/; /** Regexp for test passed line */ const CTEST_PASSED_RE = /^\s*\d+\/\d+ Test\s+#(\d+): (.+) \.\.\.+ Passed/; @@ -57,6 +57,7 @@ export interface CmakeTestOutputEvent { type: 'output'; index: number; line: string; + text?: string; } /** Test end event */ @@ -238,7 +239,8 @@ export function executeCmakeTestProcess( } else if ((matches = line.match(CTEST_OUTPUT_RE))) { // Test output const index = Number.parseInt(matches[1]); - onEvent({ type: 'output', index, line }); + const text = matches[2]; + onEvent({ type: 'output', index, line, text }); } else if ((matches = line.match(CTEST_PASSED_RE))) { // Test passed const index = Number.parseInt(matches[1]);