Add executeCommand to app container (#1857)
This commit is contained in:
@@ -3,6 +3,7 @@ import { AppEventEmitter } from "./events";
|
||||
|
||||
export interface App {
|
||||
createEventEmitter<T>(): AppEventEmitter<T>;
|
||||
executeCommand(command: string, ...args: any): Thenable<void>;
|
||||
mode: AppMode;
|
||||
subscriptions: Disposable[];
|
||||
extensionPath: string;
|
||||
|
||||
@@ -39,4 +39,8 @@ export class ExtensionApp implements App {
|
||||
public createEventEmitter<T>(): AppEventEmitter<T> {
|
||||
return new VSCodeAppEventEmitter<T>();
|
||||
}
|
||||
|
||||
public executeCommand(command: string, ...args: any): Thenable<void> {
|
||||
return vscode.commands.executeCommand(command, args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,13 @@ export function createMockApp({
|
||||
workspaceStoragePath = "/mock/workspace/storage/path",
|
||||
globalStoragePath = "/mock/global/storage/path",
|
||||
createEventEmitter = <T>() => new MockAppEventEmitter<T>(),
|
||||
executeCommand = jest.fn(() => Promise.resolve()),
|
||||
}: {
|
||||
extensionPath?: string;
|
||||
workspaceStoragePath?: string;
|
||||
globalStoragePath?: string;
|
||||
createEventEmitter?: <T>() => AppEventEmitter<T>;
|
||||
executeCommand?: () => Promise<void>;
|
||||
}): App {
|
||||
return {
|
||||
mode: AppMode.Test,
|
||||
@@ -20,6 +22,7 @@ export function createMockApp({
|
||||
workspaceStoragePath,
|
||||
globalStoragePath,
|
||||
createEventEmitter,
|
||||
executeCommand,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user