Skip to content

Commit

Permalink
testing: add errored state
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Jul 23, 2021
1 parent 4148736 commit dfa9a4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14093,6 +14093,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
5 changes: 5 additions & 0 deletions src/vs/workbench/api/common/extHostTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ class TestRunTracker extends Disposable {
started: guardTestMutation(test => {
this.proxy.$updateTestStateInRun(runId, taskId, TestId.fromExtHostTestItem(test, ctrlId).toString(), TestResultState.Running);
}),
errored: guardTestMutation((test, messages, duration) => {
this.proxy.$appendTestMessagesInRun(runId, taskId, TestId.fromExtHostTestItem(test, ctrlId).toString(),
messages instanceof Array ? messages.map(Convert.TestMessage.from) : [Convert.TestMessage.from(messages)]);
this.proxy.$updateTestStateInRun(runId, taskId, TestId.fromExtHostTestItem(test, ctrlId).toString(), TestResultState.Errored, duration);
}),
failed: guardTestMutation((test, messages, duration) => {
this.proxy.$appendTestMessagesInRun(runId, taskId, TestId.fromExtHostTestItem(test, ctrlId).toString(),
messages instanceof Array ? messages.map(Convert.TestMessage.from) : [Convert.TestMessage.from(messages)]);
Expand Down

0 comments on commit dfa9a4f

Please sign in to comment.