Skip to content

Commit

Permalink
VS Code API change to support errored state
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Jul 26, 2021
1 parent 0eaa9fa commit 2a3393e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/client/testing/testController/common/resultsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export async function updateResultFromJunitXml(
message.location = new Location(node.uri, node.range);
}

runInstance.failed(node, message);
runInstance.errored(node, message);
runInstance.appendOutput(text);
} else if (result.failure) {
failures += 1;
Expand Down Expand Up @@ -147,10 +147,12 @@ export async function updateResultFromJunitXml(
if (node.uri && node.range) {
message.location = new Location(node.uri, node.range);
}
runInstance.failed(node, message);
runInstance.errored(node, message);
}
});

runInstance.appendOutput(`Total number of tests expected to run: ${testCaseNodes.length}\r\n`);
runInstance.appendOutput(`Total number of tests run: ${passed + failures + errors + skipped}\r\n`);
runInstance.appendOutput(`Total number of tests passed: ${passed}\r\n`);
runInstance.appendOutput(`Total number of tests failed: ${failures}\r\n`);
runInstance.appendOutput(`Total number of tests failed with errors: ${errors}\r\n`);
Expand Down
5 changes: 4 additions & 1 deletion src/client/testing/testController/unittest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class UnittestRunner implements ITestsRunner {
message.location = new Location(testCase.uri, testCase.range);
}

runInstance.failed(testCase, message);
runInstance.errored(testCase, message);
runInstance.appendOutput(text);
counts.errored += 1;
if (failFast) {
Expand All @@ -146,6 +146,7 @@ export class UnittestRunner implements ITestsRunner {
if (testCase.uri && testCase.range) {
message.location = new Location(testCase.uri, testCase.range);
}
runInstance.errored(testCase, message);
}
}
});
Expand Down Expand Up @@ -209,6 +210,8 @@ export class UnittestRunner implements ITestsRunner {
this.server.stop();
}

runInstance.appendOutput(`Total number of tests expected to run: ${testCaseNodes.length}\r\n`);
runInstance.appendOutput(`Total number of tests run: ${counts.total}\r\n`);
runInstance.appendOutput(`Total number of tests passed: ${counts.passed}\r\n`);
runInstance.appendOutput(`Total number of tests failed: ${counts.failed}\r\n`);
runInstance.appendOutput(`Total number of tests failed with errors: ${counts.errored}\r\n`);
Expand Down
11 changes: 11 additions & 0 deletions types/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,17 @@ declare module 'vscode' {
*/
failed(test: TestItem, message: TestMessage | readonly TestMessage[], duration?: number): void;

/**
* Indicates a test has errored. You should pass one or more
* {@link TestMessage | TestMessages} to describe the failure. This differs
* from the "failed" state in that it indicates a test that couldn't be
* executed at all, from a compilation error for example.
* @param test Test item to update.
* @param messages Messages associated with the test failure.
* @param duration How long the test took to execute, in milliseconds.
*/
errored(test: TestItem, message: TestMessage | readonly TestMessage[], duration?: number): void;

/**
* Indicates a test has passed.
* @param test Test item to update.
Expand Down

0 comments on commit 2a3393e

Please sign in to comment.