mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 21:39:43 +00:00
testing: use real test item instances if available in command args (#162898)
Fixes https://github.com/microsoft/vscode/issues/154659 (for realsies)
This commit is contained in:
parent
a4c9ea968d
commit
b9ebb059db
|
@ -23,7 +23,7 @@ import * as Convert from 'vs/workbench/api/common/extHostTypeConverters';
|
|||
import { TestRunProfileKind, TestRunRequest } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { TestId, TestIdPathParts, TestPosition } from 'vs/workbench/contrib/testing/common/testId';
|
||||
import { InvalidTestItemError } from 'vs/workbench/contrib/testing/common/testItemCollection';
|
||||
import { AbstractIncrementalTestCollection, CoverageDetails, IFileCoverage, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, ISerializedTestResults, ITestItem, RunTestForControllerRequest, RunTestForControllerResult, TestResultState, TestRunProfileBitset, TestsDiff, TestsDiffOp } from 'vs/workbench/contrib/testing/common/testTypes';
|
||||
import { AbstractIncrementalTestCollection, CoverageDetails, IFileCoverage, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, ISerializedTestResults, ITestItem, ITestItemContext, RunTestForControllerRequest, RunTestForControllerResult, TestResultState, TestRunProfileBitset, TestsDiff, TestsDiffOp } from 'vs/workbench/contrib/testing/common/testTypes';
|
||||
import type * as vscode from 'vscode';
|
||||
|
||||
interface ControllerInfo {
|
||||
|
@ -52,8 +52,16 @@ export class ExtHostTesting implements ExtHostTestingShape {
|
|||
this.runTracker = new TestRunCoordinator(this.proxy);
|
||||
|
||||
commands.registerArgumentProcessor({
|
||||
processArgument: arg =>
|
||||
arg?.$mid === MarshalledId.TestItemContext ? toItemFromContext(arg) : arg,
|
||||
processArgument: arg => {
|
||||
if (arg?.$mid !== MarshalledId.TestItemContext) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
const cast = arg as ITestItemContext;
|
||||
const targetTest = cast.tests[cast.tests.length - 1].item.extId;
|
||||
const controller = this.controllers.get(TestId.root(targetTest));
|
||||
return controller?.collection.tree.get(targetTest)?.actual ?? toItemFromContext(arg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue