testing: initial api implementation

* wip

* wip

* wip

* wip

* wip

* wip
This commit is contained in:
Connor Peet
2020-11-20 08:31:35 -08:00
committed by GitHub
parent ff1887be3e
commit d1280418d7
16 changed files with 1732 additions and 3 deletions

View File

@@ -81,6 +81,7 @@ import { ExtHostCustomEditors } from 'vs/workbench/api/common/extHostCustomEdito
import { ExtHostWebviewPanels } from 'vs/workbench/api/common/extHostWebviewPanels';
import { ExtHostBulkEdits } from 'vs/workbench/api/common/extHostBulkEdits';
import { IExtHostFileSystemInfo } from 'vs/workbench/api/common/extHostFileSystemInfo';
import { ExtHostTesting } from 'vs/workbench/api/common/extHostTesting';
export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
@@ -152,6 +153,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostWebviewPanels = rpcProtocol.set(ExtHostContext.ExtHostWebviewPanels, new ExtHostWebviewPanels(rpcProtocol, extHostWebviews, extHostWorkspace));
const extHostCustomEditors = rpcProtocol.set(ExtHostContext.ExtHostCustomEditors, new ExtHostCustomEditors(rpcProtocol, extHostDocuments, extensionStoragePaths, extHostWebviews, extHostWebviewPanels));
const extHostWebviewViews = rpcProtocol.set(ExtHostContext.ExtHostWebviewViews, new ExtHostWebviewViews(rpcProtocol, extHostWebviews));
const extHostTesting = rpcProtocol.set(ExtHostContext.ExtHostTesting, new ExtHostTesting(rpcProtocol, extHostDocumentsAndEditors, extHostWorkspace));
// Check that no named customers are missing
const expected: ProxyIdentifier<any>[] = values(ExtHostContext);
@@ -333,6 +335,25 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
? extHostTypes.ExtensionKind.Workspace
: extHostTypes.ExtensionKind.UI;
const test: typeof vscode.test = {
registerTestProvider(provider) {
checkProposedApiEnabled(extension);
return extHostTesting.registerTestProvider(provider);
},
createDocumentTestObserver(document) {
checkProposedApiEnabled(extension);
return extHostTesting.createTextDocumentTestObserver(document);
},
createWorkspaceTestObserver(workspaceFolder) {
checkProposedApiEnabled(extension);
return extHostTesting.createWorkspaceTestObserver(workspaceFolder);
},
runTests(provider) {
checkProposedApiEnabled(extension);
return extHostTesting.runTests(provider);
},
};
// namespace: extensions
const extensions: typeof vscode.extensions = {
getExtension(extensionId: string): Extension<any> | undefined {
@@ -1072,6 +1093,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
extensions,
languages,
scm,
test,
comment,
comments,
tasks,
@@ -1197,7 +1219,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
NotebookEditorRevealType: extHostTypes.NotebookEditorRevealType,
NotebookCellOutput: extHostTypes.NotebookCellOutput,
NotebookCellOutputItem: extHostTypes.NotebookCellOutputItem,
OnTypeRenameRanges: extHostTypes.OnTypeRenameRanges
OnTypeRenameRanges: extHostTypes.OnTypeRenameRanges,
TestRunState: extHostTypes.TestRunState,
TestMessageSeverity: extHostTypes.TestMessageSeverity,
TestState: extHostTypes.TestState,
};
};
}