Skip to content

Commit 133c72b

Browse files
author
guomingliang
committed
更新d.ts到4.0.0
1 parent a37726c commit 133c72b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1128
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @description 获取HBuilderX数据目录
3+
* @returns
4+
*/
5+
export declare const hxAppDataDir: () => string;
6+
/**
7+
* @description 获取HBuilderX .log文件路径
8+
* @returns
9+
*/
10+
export declare const getHXLogFile: () => string;
11+
/**
12+
* @description 获取HBuilderX autosaves文件路径
13+
* @returns
14+
*/
15+
export declare const clearHXAutosavesPath: () => Promise<void>;
16+
/**
17+
* @description 清空HBuilderX数据目录.log文件
18+
*/
19+
export declare const clearHXLogFile: () => void;
20+
/**
21+
* @description 格式化【测试用例文件】字符串
22+
* @param openfile
23+
* @returns
24+
*/
25+
export declare const format_str_case_file: (openfile: string) => string;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare const setContext: (c: Record<any, any>) => void;
2+
export declare const getContext: () => Record<any, any>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export declare function installProjectModule(projectDir: string): Promise<void>;
2+
export declare function runScript(projectDir: string, scriptName: string): Promise<void>;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { SimpleGit } from 'simple-git';
2+
export default class Git {
3+
private options;
4+
private localDir;
5+
private url;
6+
private gitExample;
7+
constructor(localDir: string, url: string);
8+
get git(): SimpleGit;
9+
clone(): Promise<void>;
10+
status(): Promise<void>;
11+
clean(): Promise<void>;
12+
reset(): Promise<void>;
13+
checkout(branch?: string): Promise<void>;
14+
pull(): Promise<void>;
15+
fetch(): Promise<void>;
16+
resetCodeToLatestByBranch(branch?: string): Promise<void>;
17+
checkIfRepoHasUpdates(): Promise<boolean>;
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export declare function getLocalIP(): string;
2+
export declare function purgeCache(moduleName: string): any;
3+
export declare const getInitTestFile: (fileOrProjectKey: string) => string;
4+
export declare const sleep: (time?: number) => Promise<unknown>;
5+
export declare const getTmpdir: (time?: number) => string;
6+
export declare const isWin: () => boolean;
7+
export declare const getPlatform: () => string;
8+
export declare const generateCode: (file: any, recordOpt: any) => string;
9+
export declare const requireFunc: any;

other/hbuilderx-autotest/config.d.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import * as convict from 'convict';
2+
declare const config: convict.Config<{
3+
dev: string;
4+
alpha: string;
5+
release: string;
6+
testsStorage: string;
7+
lsTestsStorage: string;
8+
lsTestReportDir: string;
9+
hxMarketPLuginDir: string;
10+
mountSmbfs: string;
11+
tagrelease: string;
12+
tagdev: string;
13+
tagalpha: string;
14+
autoUpdate: boolean;
15+
mainStorage: string;
16+
}>;
17+
export default config;
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default class Assert {
2+
private res;
3+
private file;
4+
constructor(file: string);
5+
expectArrayIncludes(casename: string, targetArray: string[], includeArray: string[]): void;
6+
expectEquals(casename: string, target: any, expect: any): void;
7+
expectMatches(casename: string, target: string, expect: RegExp): void;
8+
expectTrue(casename: string, value: boolean, context?: any): void;
9+
get result(): {
10+
count: number;
11+
caseFail: any[];
12+
cassAll: any[];
13+
};
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
import { Position, Range } from 'vscode-languageserver';
2+
import { Editor, TextDocument } from './editor';
3+
export interface AutoTestCase<T> {
4+
kind: string;
5+
title: string;
6+
tag?: string;
7+
expect: T;
8+
error?: {
9+
message: string;
10+
cause: string;
11+
};
12+
}
13+
export interface KeybindingExpect {
14+
/**
15+
* apply之后对应的函内容匹配
16+
*/
17+
lines: string[] | RegExp[];
18+
/**
19+
* apply之后对应的光标位置
20+
*/
21+
cursor?: Position;
22+
}
23+
export interface AutoTestKeybindCase extends AutoTestCase<KeybindingExpect> {
24+
kind: 'keybind';
25+
range: Range;
26+
input: string;
27+
typeInNewLine?: boolean;
28+
keybind: string;
29+
}
30+
export interface AutoTestCheckEditorCase extends AutoTestCase<KeybindingExpect> {
31+
kind: 'checkEditor';
32+
}
33+
export interface AutoEditExpect {
34+
/**
35+
* apply之后对应的函内容匹配
36+
*/
37+
lines: string[] | RegExp[];
38+
/**
39+
* apply之后对应的光标位置
40+
*/
41+
cursor?: Position;
42+
}
43+
export interface AutoTestAutoEditCase extends AutoTestCase<AutoEditExpect> {
44+
kind: 'autoedit';
45+
range: Range;
46+
typeInNewLine?: boolean;
47+
input: string;
48+
}
49+
export interface DefinitionExpect {
50+
uri: string;
51+
line: string | RegExp;
52+
cursor?: number;
53+
}
54+
export interface AutoTestDefinitionCase extends AutoTestCase<DefinitionExpect> {
55+
kind: 'definition';
56+
range: Range;
57+
}
58+
export interface HoverExpect {
59+
/**
60+
* hover的内容
61+
*/
62+
content: string | RegExp;
63+
/**
64+
* 是否支持F1打开帮助文档
65+
*/
66+
supportF1?: boolean;
67+
}
68+
export interface AutoTestHoverCase extends AutoTestCase<HoverExpect> {
69+
kind: 'hover' | 'noerror' | 'error';
70+
range: Range;
71+
docOffsetAt: number;
72+
type: 'string';
73+
}
74+
export interface OutlineExpect {
75+
filePath: string;
76+
}
77+
export interface AutoTestOutlineCase extends AutoTestCase<OutlineExpect> {
78+
kind: 'outline';
79+
needCreate?: boolean;
80+
project: string;
81+
lsDir: string;
82+
programData: string;
83+
programPlugin: string;
84+
}
85+
export interface ReferencesExpect {
86+
filePath: string;
87+
}
88+
export interface AutoTestReferencesCase extends AutoTestCase<ReferencesExpect> {
89+
kind: 'references';
90+
needCreate?: boolean;
91+
range: Range;
92+
docOffsetAt: number;
93+
project: string;
94+
lsDir: string;
95+
programData: string;
96+
programPlugin: string;
97+
}
98+
export interface ErrorExpect {
99+
content: string | RegExp;
100+
}
101+
export interface CompletionExpect {
102+
/**
103+
* 代码助手列表项
104+
*/
105+
items: string[];
106+
/**
107+
* 代码助手列表项-不能包含项
108+
*/
109+
excludeItems: string[];
110+
/**
111+
* apply之后对应的函内容匹配
112+
*/
113+
lines: string[] | RegExp[];
114+
/**
115+
* apply之后对应的光标位置
116+
*/
117+
cursor?: Position;
118+
/**
119+
* apply的item的详细信息
120+
*/
121+
detail?: string | RegExp;
122+
}
123+
export interface AutoTestCompletionCase extends AutoTestCase<CompletionExpect> {
124+
kind: 'completion' | 'init';
125+
/**
126+
* 是否在新的一行写,如为true,则会在range位置回车后开始写
127+
*/
128+
typeInNewLine?: boolean;
129+
/**
130+
* 要输入的位置
131+
*/
132+
range: Range;
133+
/**
134+
* 要输入的文字
135+
*/
136+
input: string;
137+
/**
138+
* 选择哪一项,默认是第一项。下标从`0`开始
139+
*/
140+
applyIndex?: number;
141+
}
142+
export interface AutoTestDbClickCase extends AutoTestCase<DbClickExpect> {
143+
kind: 'dbclick';
144+
range: Range;
145+
}
146+
export interface DbClickExpect {
147+
begin: string;
148+
end: string;
149+
match: string;
150+
}
151+
export interface PerformanceExpect {
152+
expect: AutoTestDefinitionCase | AutoTestHoverCase | AutoTestCompletionCase;
153+
}
154+
export interface AutoTestPerformanceCase extends AutoTestCase<PerformanceExpect> {
155+
kind: 'performance';
156+
type: string;
157+
num: number;
158+
timer: number;
159+
range: Range;
160+
}
161+
interface TestCaseResult {
162+
casename: string;
163+
passed: boolean;
164+
message?: string;
165+
filePath?: string;
166+
}
167+
export declare function getTestMergedResults(testResults: TestCaseResult[], project_name: string, autotestOptions: any): unknown[];
168+
export declare function generateTestReport(testResults: TestCaseResult[], testBaseInfo: any, allCase: number): any;
169+
export declare function matchTestcaseContent(line: string): string | undefined;
170+
export declare function scan(doc: TextDocument, project: string, config: any, range?: {
171+
startLine: number;
172+
endLine: number;
173+
}): AutoTestCase<any>[][];
174+
export declare function runCaseItem(testcase: AutoTestCase<any>, editor: Editor, config?: any): Promise<any[]>;
175+
export declare function runcase(testcase: AutoTestCase<any>, editor: Editor, config?: any): Promise<any[]>;
176+
export {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { AutoTestCheckEditorCase, AutoTestCompletionCase, AutoTestDbClickCase, AutoTestDefinitionCase, AutoTestHoverCase, AutoTestKeybindCase, AutoTestOutlineCase, AutoTestPerformanceCase, AutoTestReferencesCase } from './autotest';
2+
import { Editor } from './editor';
3+
declare function runDbClickCase(test: AutoTestDbClickCase, editor: Editor): Promise<({
4+
casename: string;
5+
passed: boolean;
6+
message: string;
7+
} | {
8+
casename: string;
9+
passed: boolean;
10+
message?: undefined;
11+
})[]>;
12+
declare function runCompletionCase(test: AutoTestCompletionCase, editor: Editor, config?: any): Promise<any[]>;
13+
declare function runKeybindCase(test: AutoTestKeybindCase, editor: Editor): Promise<any[]>;
14+
declare function runDefinitionCase(test: AutoTestDefinitionCase, editor: Editor): Promise<({
15+
casename: string;
16+
passed: boolean;
17+
message: string;
18+
} | {
19+
casename: string;
20+
passed: boolean;
21+
message?: undefined;
22+
})[]>;
23+
declare function runHoverCase(test: AutoTestHoverCase, editor: Editor): Promise<any[]>;
24+
declare function runNoErrorCase(test: AutoTestHoverCase, editor: Editor): Promise<any[]>;
25+
declare function runCheckEditor(test: AutoTestCheckEditorCase, editor: Editor): Promise<void>;
26+
declare function runErrorCase(test: AutoTestHoverCase, editor: Editor): Promise<any[]>;
27+
declare function runPerformanceCase(test: AutoTestPerformanceCase, editor: Editor): Promise<({
28+
casename: string;
29+
passed: boolean;
30+
timer: any;
31+
message: string;
32+
} | {
33+
casename: string;
34+
timer: any;
35+
passed: boolean;
36+
message?: undefined;
37+
} | {
38+
casename: string;
39+
passed: boolean;
40+
message: string;
41+
timer?: undefined;
42+
})[]>;
43+
declare function runOutlineCase(test: AutoTestOutlineCase, editor: Editor): Promise<any[]>;
44+
declare function runReferencesCase(test: AutoTestReferencesCase, editor: Editor): Promise<any[]>;
45+
export { runCheckEditor, runCompletionCase, runDbClickCase, runDefinitionCase, runErrorCase, runHoverCase, runKeybindCase, runNoErrorCase, runOutlineCase, runPerformanceCase, runReferencesCase };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { AutoTestOutlineCase } from '../autotest';
2+
import { Editor } from '../editor';
3+
import { HBuilderX } from '../hxdriver';
4+
import { TreeItem, TreeItemInfo } from '../treeItem';
5+
declare class Outline {
6+
readonly hx: HBuilderX;
7+
protected treeItem: TreeItem;
8+
constructor(hx: HBuilderX);
9+
private getFilePath;
10+
/**
11+
* 获取大纲文件数据
12+
*/
13+
getFileOutlineData(jsonFilePath: string, needCreate: boolean): TreeItemInfo | undefined;
14+
/**
15+
* 对比结果
16+
*/
17+
comparativeData(mainData: TreeItemInfo, targetData: TreeItemInfo, title: string, result: any[]): Promise<boolean>;
18+
/**
19+
* 处理点击跳转
20+
*/
21+
doTreeItemJump(test: AutoTestOutlineCase, jsonData: TreeItemInfo, filePath: string, title: string, result: any[]): Promise<void>;
22+
/**
23+
* 执行大纲测试用例
24+
*/
25+
runOutlineCase(test: AutoTestOutlineCase, editor: Editor): Promise<any[]>;
26+
}
27+
export { Outline };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { AutoTestReferencesCase } from '../autotest';
2+
import { Editor } from '../editor';
3+
import { HBuilderX } from '../hxdriver';
4+
import { TreeItem, TreeItemInfo } from '../treeItem';
5+
declare class References {
6+
readonly hx: HBuilderX;
7+
protected treeItem: TreeItem;
8+
constructor(hx: HBuilderX);
9+
private getFilePath;
10+
/**
11+
* 获取文件数据
12+
*/
13+
getFileReferencesData(jsonFilePath: string, needCreate: boolean): TreeItemInfo | undefined;
14+
/**
15+
* 对比结果
16+
*/
17+
comparativeData(mainData: TreeItemInfo, targetData: TreeItemInfo, title: string, result: any[]): Promise<boolean>;
18+
/**
19+
* 处理点击跳转
20+
*/
21+
doTreeItemJump(test: AutoTestReferencesCase, jsonData: TreeItemInfo, filePath: string, title: string, result: any[]): Promise<void>;
22+
/**
23+
* 执行查找引用测试用例
24+
* @param test
25+
* @param editor
26+
* @returns
27+
*/
28+
runReferencesCase(test: AutoTestReferencesCase, editor: Editor): Promise<any[]>;
29+
}
30+
export { References };

0 commit comments

Comments
 (0)