Skip to content

Commit 51cc273

Browse files
author
Barry Jaspan
committed
Move vscode-common's TestHelpers interface to its own file.
1 parent a59841b commit 51cc273

File tree

3 files changed

+56
-50
lines changed

3 files changed

+56
-50
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import type {
2+
CommandServerApi,
3+
ExcludableSnapshotField,
4+
ExtraSnapshotField,
5+
HatTokenMap,
6+
IDE,
7+
NormalizedIDE,
8+
ScopeProvider,
9+
SerializedMarks, TargetPlainObject,
10+
TestCaseSnapshot,
11+
TextEditor
12+
} from "@cursorless/common";
13+
import * as vscode from "vscode";
14+
import {VscodeApi} from "./VscodeApi";
15+
16+
17+
export interface TestHelpers {
18+
ide: NormalizedIDE;
19+
injectIde: (ide: IDE) => void;
20+
21+
scopeProvider: ScopeProvider;
22+
23+
hatTokenMap: HatTokenMap;
24+
25+
commandServerApi: CommandServerApi;
26+
27+
toVscodeEditor(editor: TextEditor): vscode.TextEditor;
28+
29+
setStoredTarget(
30+
editor: vscode.TextEditor,
31+
key: string,
32+
targets: TargetPlainObject[] | undefined
33+
): void;
34+
35+
// FIXME: Remove this once we have a better way to get this function
36+
// accessible from our tests
37+
takeSnapshot(
38+
excludeFields: ExcludableSnapshotField[],
39+
extraFields: ExtraSnapshotField[],
40+
editor: TextEditor,
41+
ide: IDE,
42+
marks: SerializedMarks | undefined,
43+
forceRealClipboard: boolean
44+
): Promise<TestCaseSnapshot>;
45+
46+
runIntegrationTests(): Promise<void>;
47+
48+
cursorlessTalonStateJsonPath: string;
49+
50+
/**
51+
* A thin wrapper around the VSCode API that allows us to mock it for testing.
52+
*/
53+
vscodeApi: VscodeApi;
54+
}

packages/vscode-common/src/getExtensionApi.ts

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,10 @@
11
import type {
22
CommandServerApi,
3-
ExcludableSnapshotField,
4-
ExtraSnapshotField,
5-
HatTokenMap,
6-
IDE,
7-
NormalizedIDE,
8-
ScopeProvider,
9-
SerializedMarks,
103
SnippetMap,
11-
TargetPlainObject,
12-
TestCaseSnapshot,
13-
TextEditor,
144
} from "@cursorless/common";
155
import * as vscode from "vscode";
166
import type { Language, SyntaxNode, Tree } from "web-tree-sitter";
17-
import { VscodeApi } from "./VscodeApi";
18-
19-
export interface TestHelpers {
20-
ide: NormalizedIDE;
21-
injectIde: (ide: IDE) => void;
22-
23-
scopeProvider: ScopeProvider;
24-
25-
hatTokenMap: HatTokenMap;
26-
27-
commandServerApi: CommandServerApi;
28-
29-
toVscodeEditor(editor: TextEditor): vscode.TextEditor;
30-
31-
setStoredTarget(
32-
editor: vscode.TextEditor,
33-
key: string,
34-
targets: TargetPlainObject[] | undefined,
35-
): void;
36-
37-
// FIXME: Remove this once we have a better way to get this function
38-
// accessible from our tests
39-
takeSnapshot(
40-
excludeFields: ExcludableSnapshotField[],
41-
extraFields: ExtraSnapshotField[],
42-
editor: TextEditor,
43-
ide: IDE,
44-
marks: SerializedMarks | undefined,
45-
forceRealClipboard: boolean,
46-
): Promise<TestCaseSnapshot>;
47-
48-
runIntegrationTests(): Promise<void>;
49-
50-
cursorlessTalonStateJsonPath: string;
51-
52-
/**
53-
* A thin wrapper around the VSCode API that allows us to mock it for testing.
54-
*/
55-
vscodeApi: VscodeApi;
56-
}
7+
import {TestHelpers} from "./TestHelpers";
578

589
export interface CursorlessApi {
5910
testHelpers: TestHelpers | undefined;

packages/vscode-common/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from "./getExtensionApi";
2+
export * from "./TestHelpers";
23
export * from "./notebook";
34
export * from "./testUtil/openNewEditor";
45
export * from "./vscodeUtil";

0 commit comments

Comments
 (0)