From d91ee1683a947e3aca3c37a8855b82f21583237c Mon Sep 17 00:00:00 2001 From: Mate Pek Date: Thu, 1 Dec 2022 12:32:05 +0800 Subject: [PATCH] debug improvements --- CHANGELOG.md | 2 ++ src/Configurations.ts | 7 +++++++ src/WorkspaceManager.ts | 10 +++++----- src/main.ts | 12 ++++++++++-- test/cpp/catch2/Catch2v3Test.cmake | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0621116..b3f9fc20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +## [4.3.6] + ## [4.3.5] - 2022-11-28 ## [4.3.4] - 2022-10-28 diff --git a/src/Configurations.ts b/src/Configurations.ts index d68a533b..dcd8c840 100644 --- a/src/Configurations.ts +++ b/src/Configurations.ts @@ -58,6 +58,10 @@ class ConfigurationChangeEvent { /// +export const setEnvKey = 'testMate.cpp.debug.setEnv'; + +/// + export class Configurations { private _cfg: vscode.WorkspaceConfiguration; @@ -109,6 +113,9 @@ export class Configurations { if (typeof templateFromConfig === 'object' && templateFromConfig !== null) { Object.assign(template, templateFromConfig); + // assign does not unwrap Proxy so we have to do it + //https://github.com/matepek/vscode-catch2-test-adapter/issues/369 + template[setEnvKey] = Object.assign({}, templateFromConfig[setEnvKey]); this._log.debug('template', template); return { template, source: 'userDefined', launchSourceFileMap: {} }; diff --git a/src/WorkspaceManager.ts b/src/WorkspaceManager.ts index df19a6e6..7e983869 100644 --- a/src/WorkspaceManager.ts +++ b/src/WorkspaceManager.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import { Config, Configurations } from './Configurations'; +import { Config, Configurations, setEnvKey } from './Configurations'; import { LoggerWrapper } from './LoggerWrapper'; import { createPythonIndexerForArray, @@ -279,12 +279,12 @@ export class WorkspaceManager implements vscode.Disposable { executables: Map, cancellation: vscode.CancellationToken, run: vscode.TestRun, - ): Thenable { + ): Promise { for (const exec of executables.values()) for (const test of exec) run.enqueued(test.item); return this._runInner(executables, cancellation, run).catch(e => { this.log.errorS('error during run', e); - debugger; + throw e; }); } @@ -380,11 +380,12 @@ export class WorkspaceManager implements vscode.Disposable { } } - debug(test: AbstractTest, cancellation: vscode.CancellationToken, run: vscode.TestRun): Thenable { + debug(test: AbstractTest, cancellation: vscode.CancellationToken, run: vscode.TestRun): Promise { run.enqueued(test.item); return this._debugInner(test, cancellation, run).catch(e => { this.log.errorS('error during debug', e); + throw e; }); } @@ -417,7 +418,6 @@ export class WorkspaceManager implements vscode.Disposable { const envVars = Object.assign({}, process.env, executable.shared.options.env); { - const setEnvKey = 'testMate.cpp.debug.setEnv'; if (typeof debugConfigData.template[setEnvKey] === 'object') { for (const envName in debugConfigData.template[setEnvKey]) { const envValue = debugConfigData.template[setEnvKey][envName]; diff --git a/src/main.ts b/src/main.ts index 282533d9..0380db2a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -146,7 +146,11 @@ export async function activate(context: vscode.ExtensionContext): Promise const runQueue: Thenable[] = []; for (const [manager, executables] of managers) { - runQueue.push(manager.run(executables, cancellation, testRun)); + runQueue.push( + manager.run(executables, cancellation, testRun).catch(e => { + vscode.window.showErrorMessage('Unexpected error from run: ' + e); + }), + ); } await Promise.allSettled(runQueue); @@ -200,7 +204,11 @@ export async function activate(context: vscode.ExtensionContext): Promise return; } const test = testsToRun.direct[0]; - runQueue.push(manager.debug(test, cancellation, testRun)); + runQueue.push( + manager.debug(test, cancellation, testRun).catch(e => { + vscode.window.showErrorMessage('Unexpected error from debug: ' + e); + }), + ); } await Promise.allSettled(runQueue); diff --git a/test/cpp/catch2/Catch2v3Test.cmake b/test/cpp/catch2/Catch2v3Test.cmake index ea0fd781..19ad08ea 100644 --- a/test/cpp/catch2/Catch2v3Test.cmake +++ b/test/cpp/catch2/Catch2v3Test.cmake @@ -2,7 +2,7 @@ include(FetchContent) FetchContent_Declare(catch2v3test GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v3.0.0-preview5) + GIT_TAG v3.1.1) FetchContent_GetProperties(catch2v3test) if(NOT catch2v3test_POPULATED)