Skip to content

Commit

Permalink
fix - Show error message when test runner finishes (#1713)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdneo authored Jul 22, 2024
1 parent f86932f commit e78dc4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/controller/testController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,14 @@ async function executeWithTestRunner(option: IRunOption, testRunner: TestRunner,
}
}));

disposables.push(testRunner.onDidFinishTestRun((_event: TestFinishEvent) => {
disposables.push(testRunner.onDidFinishTestRun((event: TestFinishEvent) => {
if (event.statusCode !== 0) {
window.showErrorMessage(event.message ?? 'Failed to run tests.');
}
return resolve();
}));

testRunner.launch(testContext);
await testRunner.launch(testContext);
});

function findTestClass(parts: TestIdParts): TestItem {
Expand Down
4 changes: 2 additions & 2 deletions src/java-test-runner.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export interface TestIdParts {
*/
export interface TestRunner {
/**
* launch test test execution.
* launch the test execution.
* @param context the context for this test run.
*/
launch(context: IRunTestContext): void;
launch(context: IRunTestContext): vscode.ProviderResult<void>;

/**
* Event that should be emitted when the status of a test item changes.
Expand Down

0 comments on commit e78dc4a

Please sign in to comment.