From 4f13aca1307474ca165f6c517924e4725e05a00a Mon Sep 17 00:00:00 2001 From: leon3108 Date: Tue, 19 Dec 2023 17:46:45 +0100 Subject: [PATCH] feat: show logs when test failed --- .../solidity/extension/src/tests/test-manager.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/toolchains/solidity/extension/src/tests/test-manager.ts b/toolchains/solidity/extension/src/tests/test-manager.ts index 5a13c3ef..9b77deb2 100644 --- a/toolchains/solidity/extension/src/tests/test-manager.ts +++ b/toolchains/solidity/extension/src/tests/test-manager.ts @@ -90,9 +90,16 @@ export class TestManager { const functionResult = await testFunction(this.workspace, test.parent!.label, test.label); const functionTime = Date.now() - date; if (this.analyzeTestResults(functionResult)) { - run.passed(test, functionTime); + run.passed(test, functionTime); } else { - run.failed(test, new vscode.TestMessage("Contract test failed"), functionTime); + for (const suiteResult of Object.values(functionResult)) { + for (const testResult of Object.values(suiteResult.test_results)) { + run.appendOutput(testResult.decoded_logs[0]); + run.appendOutput(testResult.decoded_logs[1]); + run.appendOutput(testResult.decoded_logs[2]); + } + } + run.failed(test, new vscode.TestMessage("Contract test failed"), functionTime); } break; }