|
|
|
@@ -98,13 +98,19 @@ import { ITestProfileService } from 'vs/workbench/contrib/testing/common/testPro
|
|
|
|
|
import { ITaskRawOutput, ITestResult, ITestRunTaskResults, LiveTestResult, TestResultItemChange, TestResultItemChangeReason, maxCountPriority, resultItemParents } from 'vs/workbench/contrib/testing/common/testResult';
|
|
|
|
|
import { ITestResultService, ResultChangeEvent } from 'vs/workbench/contrib/testing/common/testResultService';
|
|
|
|
|
import { ITestService } from 'vs/workbench/contrib/testing/common/testService';
|
|
|
|
|
import { IRichLocation, ITestErrorMessage, ITestItem, ITestMessage, ITestMessageMenuArgs, ITestRunTask, ITestTaskState, TestMessageType, TestResultItem, TestResultState, TestRunProfileBitset, getMarkId } from 'vs/workbench/contrib/testing/common/testTypes';
|
|
|
|
|
import { IRichLocation, ITestErrorMessage, ITestItem, ITestItemContext, ITestMessage, ITestMessageMenuArgs, ITestRunTask, ITestTaskState, InternalTestItem, TestMessageType, TestResultItem, TestResultState, TestRunProfileBitset, getMarkId, testResultStateToContextValues } from 'vs/workbench/contrib/testing/common/testTypes';
|
|
|
|
|
import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys';
|
|
|
|
|
import { IShowResultOptions, ITestingPeekOpener } from 'vs/workbench/contrib/testing/common/testingPeekOpener';
|
|
|
|
|
import { cmpPriority, isFailedState } from 'vs/workbench/contrib/testing/common/testingStates';
|
|
|
|
|
import { ParsedTestUri, TestUriType, buildTestUri, parseTestUri } from 'vs/workbench/contrib/testing/common/testingUri';
|
|
|
|
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
|
|
|
|
|
|
|
|
|
const getMessageArgs = (test: TestResultItem, message: ITestMessage): ITestMessageMenuArgs => ({
|
|
|
|
|
$mid: MarshalledId.TestMessageMenuArgs,
|
|
|
|
|
test: InternalTestItem.serialize(test),
|
|
|
|
|
message: ITestMessage.serialize(message),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
class MessageSubject {
|
|
|
|
|
public readonly test: ITestItem;
|
|
|
|
|
public readonly message: ITestMessage;
|
|
|
|
@@ -112,6 +118,7 @@ class MessageSubject {
|
|
|
|
|
public readonly actualUri: URI;
|
|
|
|
|
public readonly messageUri: URI;
|
|
|
|
|
public readonly revealLocation: IRichLocation | undefined;
|
|
|
|
|
public readonly context: ITestMessageMenuArgs | undefined;
|
|
|
|
|
|
|
|
|
|
public get isDiffable() {
|
|
|
|
|
return this.message.type === TestMessageType.Error && isDiffable(this.message);
|
|
|
|
@@ -121,14 +128,6 @@ class MessageSubject {
|
|
|
|
|
return this.message.type === TestMessageType.Error ? this.message.contextValue : undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public get context(): ITestMessageMenuArgs {
|
|
|
|
|
return {
|
|
|
|
|
$mid: MarshalledId.TestMessageMenuArgs,
|
|
|
|
|
extId: this.test.extId,
|
|
|
|
|
message: ITestMessage.serialize(this.message),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constructor(public readonly result: ITestResult, test: TestResultItem, public readonly taskIndex: number, public readonly messageIndex: number) {
|
|
|
|
|
this.test = test.item;
|
|
|
|
|
const messages = test.tasks[taskIndex].messages;
|
|
|
|
@@ -140,6 +139,7 @@ class MessageSubject {
|
|
|
|
|
this.messageUri = buildTestUri({ ...parts, type: TestUriType.ResultMessage });
|
|
|
|
|
|
|
|
|
|
const message = this.message = messages[this.messageIndex];
|
|
|
|
|
this.context = getMessageArgs(test, message);
|
|
|
|
|
this.revealLocation = message.location ?? (test.item.uri && test.item.range ? { uri: test.item.uri, range: Range.lift(test.item.range) } : undefined);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -1745,7 +1745,10 @@ class CoverageElement implements ITreeElement {
|
|
|
|
|
|
|
|
|
|
class TestCaseElement implements ITreeElement {
|
|
|
|
|
public readonly type = 'test';
|
|
|
|
|
public readonly context = this.test.item.extId;
|
|
|
|
|
public readonly context: ITestItemContext = {
|
|
|
|
|
$mid: MarshalledId.TestItemContext,
|
|
|
|
|
tests: [InternalTestItem.serialize(this.test)],
|
|
|
|
|
};
|
|
|
|
|
public readonly id = `${this.results.id}/${this.test.item.extId}`;
|
|
|
|
|
public readonly description?: string;
|
|
|
|
|
|
|
|
|
@@ -1826,13 +1829,12 @@ class TestMessageElement implements ITreeElement {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public get context(): ITestMessageMenuArgs {
|
|
|
|
|
return {
|
|
|
|
|
$mid: MarshalledId.TestMessageMenuArgs,
|
|
|
|
|
extId: this.test.item.extId,
|
|
|
|
|
message: ITestMessage.serialize(this.message),
|
|
|
|
|
};
|
|
|
|
|
return getMessageArgs(this.test, this.message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public get outputSubject() {
|
|
|
|
|
return new TestOutputSubject(this.result, this.taskIndex, this.test);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
public readonly result: ITestResult,
|
|
|
|
@@ -2357,11 +2359,10 @@ class TreeActionsProvider {
|
|
|
|
|
if (element instanceof TestCaseElement || element instanceof TestMessageElement) {
|
|
|
|
|
contextKeys.push(
|
|
|
|
|
[TestingContextKeys.testResultOutdated.key, element.test.retired],
|
|
|
|
|
[TestingContextKeys.testResultState.key, testResultStateToContextValues[element.test.ownComputedState]],
|
|
|
|
|
...getTestItemContextOverlay(element.test, capabilities),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (element instanceof TestCaseElement) {
|
|
|
|
|
const extId = element.test.item.extId;
|
|
|
|
|
if (element.test.tasks[element.taskIndex].messages.some(m => m.type === TestMessageType.Output)) {
|
|
|
|
|
primary.push(new Action(
|
|
|
|
@@ -2401,12 +2402,15 @@ class TreeActionsProvider {
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (element instanceof TestMessageElement) {
|
|
|
|
|
primary.push(new Action(
|
|
|
|
|
'testing.outputPeek.goToFile',
|
|
|
|
|
localize('testing.goToFile', "Go to Source"),
|
|
|
|
|
ThemeIcon.asClassName(Codicon.goToFile),
|
|
|
|
|
undefined,
|
|
|
|
|
() => this.commandService.executeCommand('vscode.revealTest', extId),
|
|
|
|
|
() => this.commandService.executeCommand('vscode.revealTest', element.test.item.extId),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|