diff --git a/CHANGELOG.md b/CHANGELOG.md index 2189f0951..5850769ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Features: Bug Fixes: +- Fix issue "Logs are unavailable when running tests from the Test Explorer" and display properly the test output. [#3140](https://github.com/microsoft/vscode-cmake-tools/issues/3140) - Fix issue with "Test Results Not Found" when `cmake.ctest.allowParallelJobs` is disabled. [#3798](https://github.com/microsoft/vscode-cmake-tools/issues/3798) - Update localized strings for Project Status UI and quick pick dropdowns. [#3803](https://github.com/microsoft/vscode-cmake-tools/issues/3803), [#3802](https://github.com/microsoft/vscode-cmake-tools/issues/3802) - Fix issue where new presets couldn't inherit from presets in CmakeUserPresets.json. These presets are now added to CmakeUserPresets.json instead of CmakePresets.json. [#3725](https://github.com/microsoft/vscode-cmake-tools/issues/3725) diff --git a/src/ctest.ts b/src/ctest.ts index 0d92e013c..109c17ad1 100644 --- a/src/ctest.ts +++ b/src/ctest.ts @@ -532,10 +532,13 @@ export class CTestDriver implements vscode.Disposable { } let output = testResult.output; - if (process.platform === 'win32') { - output = output.replace(/\r?\n/g, '\r\n'); + // https://code.visualstudio.com/api/extension-guides/testing#test-output + output = output.replace(/\r?\n/g, '\r\n'); + if (test.uri && test.range) { + run.appendOutput(output, new vscode.Location(test.uri, test.range.end), test); + } else { + run.appendOutput(output, undefined, test); } - run.appendOutput(output); if (testResult.status !== 'passed' && !havefailures) { const failureDurationStr = testResult.measurements.get("Execution Time")?.value; @@ -997,7 +1000,7 @@ export class CTestDriver implements vscode.Disposable { .find(test => test.name === testName)?.properties .find(prop => prop.name === 'WORKING_DIRECTORY'); - if (typeof(property?.value) === 'string') { + if (typeof (property?.value) === 'string') { return property.value; } return '';