Skip to content

Commit e78dc4a

Browse files
authored
fix - Show error message when test runner finishes (#1713)
1 parent f86932f commit e78dc4a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/controller/testController.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,14 @@ async function executeWithTestRunner(option: IRunOption, testRunner: TestRunner,
362362
}
363363
}));
364364

365-
disposables.push(testRunner.onDidFinishTestRun((_event: TestFinishEvent) => {
365+
disposables.push(testRunner.onDidFinishTestRun((event: TestFinishEvent) => {
366+
if (event.statusCode !== 0) {
367+
window.showErrorMessage(event.message ?? 'Failed to run tests.');
368+
}
366369
return resolve();
367370
}));
368371

369-
testRunner.launch(testContext);
372+
await testRunner.launch(testContext);
370373
});
371374

372375
function findTestClass(parts: TestIdParts): TestItem {

src/java-test-runner.api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ export interface TestIdParts {
5454
*/
5555
export interface TestRunner {
5656
/**
57-
* launch test test execution.
57+
* launch the test execution.
5858
* @param context the context for this test run.
5959
*/
60-
launch(context: IRunTestContext): void;
60+
launch(context: IRunTestContext): vscode.ProviderResult<void>;
6161

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

0 commit comments

Comments
 (0)