Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
feat: show logs when test failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon-azerty committed Dec 19, 2023
1 parent 8c667d7 commit 4f13aca
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions toolchains/solidity/extension/src/tests/test-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4f13aca

Please sign in to comment.