@mpcore/test 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +23 -23
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ interface RoleQueryOptions {
|
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/screen/index.d.ts
|
|
9
|
-
declare class MiniProgramNode {
|
|
9
|
+
export declare class MiniProgramNode {
|
|
10
10
|
private readonly owner;
|
|
11
11
|
readonly nodeId: string;
|
|
12
12
|
constructor(owner: MiniProgramScreen, nodeId: string);
|
|
@@ -23,7 +23,7 @@ declare class MiniProgramNode {
|
|
|
23
23
|
get textContent(): string;
|
|
24
24
|
getAttribute(name: string): string;
|
|
25
25
|
}
|
|
26
|
-
declare class MiniProgramScreen {
|
|
26
|
+
export declare class MiniProgramScreen {
|
|
27
27
|
private readonly page;
|
|
28
28
|
private currentSnapshot;
|
|
29
29
|
private readonly rootNodeId?;
|
|
@@ -67,7 +67,7 @@ declare class MiniProgramScreen {
|
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/user.d.ts
|
|
70
|
-
declare class MiniProgramUser {
|
|
70
|
+
export declare class MiniProgramUser {
|
|
71
71
|
private readonly page;
|
|
72
72
|
private readonly screen;
|
|
73
73
|
private readonly settle;
|
|
@@ -82,30 +82,30 @@ declare class MiniProgramUser {
|
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/types.d.ts
|
|
85
|
-
interface MiniProgramArtifact {
|
|
85
|
+
export interface MiniProgramArtifact {
|
|
86
86
|
appConfigPath?: string;
|
|
87
87
|
miniprogramRootPath?: string;
|
|
88
88
|
projectPath: string;
|
|
89
89
|
}
|
|
90
|
-
interface WxHostMock {
|
|
90
|
+
export interface WxHostMock {
|
|
91
91
|
actionSheet?: HeadlessWxActionSheetMockDefinition | HeadlessWxActionSheetMockDefinition[];
|
|
92
92
|
downloadFile?: HeadlessWxDownloadFileMockDefinition | HeadlessWxDownloadFileMockDefinition[];
|
|
93
93
|
modal?: HeadlessWxModalMockDefinition | HeadlessWxModalMockDefinition[];
|
|
94
94
|
request?: HeadlessWxRequestMockDefinition | HeadlessWxRequestMockDefinition[];
|
|
95
95
|
uploadFile?: HeadlessWxUploadFileMockDefinition | HeadlessWxUploadFileMockDefinition[];
|
|
96
96
|
}
|
|
97
|
-
interface CreateTestProjectOptions {
|
|
97
|
+
export interface CreateTestProjectOptions {
|
|
98
98
|
artifact: MiniProgramArtifact;
|
|
99
99
|
failOnConsoleError?: boolean;
|
|
100
100
|
host?: WxHostMock;
|
|
101
101
|
platform?: PlatformAdapter;
|
|
102
102
|
}
|
|
103
|
-
interface RenderComponentOptions {
|
|
103
|
+
export interface RenderComponentOptions {
|
|
104
104
|
on?: Record<string, (detail: unknown, event: Record<string, any>) => void>;
|
|
105
105
|
properties?: Record<string, unknown>;
|
|
106
106
|
slots?: Record<string, string>;
|
|
107
107
|
}
|
|
108
|
-
interface MiniProgramRenderResult {
|
|
108
|
+
export interface MiniProgramRenderResult {
|
|
109
109
|
close: () => Promise<void>;
|
|
110
110
|
diagnostics: () => RuntimeDiagnosticEntry[];
|
|
111
111
|
emitted: (eventName: string) => unknown[];
|
|
@@ -113,26 +113,26 @@ interface MiniProgramRenderResult {
|
|
|
113
113
|
screen: MiniProgramScreen;
|
|
114
114
|
user: MiniProgramUser;
|
|
115
115
|
}
|
|
116
|
-
interface MiniProgramEmissionSource {
|
|
116
|
+
export interface MiniProgramEmissionSource {
|
|
117
117
|
emitted: (eventName: string) => unknown[];
|
|
118
118
|
}
|
|
119
|
-
interface MiniProgramMatcherResult {
|
|
119
|
+
export interface MiniProgramMatcherResult {
|
|
120
120
|
message: () => string;
|
|
121
121
|
pass: boolean;
|
|
122
122
|
}
|
|
123
|
-
type MiniProgramNodeLike = MiniProgramNode;
|
|
123
|
+
export type MiniProgramNodeLike = MiniProgramNode;
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region src/host.d.ts
|
|
126
|
-
declare function createWxMock(definition?: WxHostMock): WxHostMock;
|
|
127
|
-
declare function applyWxMock(session: HeadlessSession, definition?: WxHostMock): void;
|
|
126
|
+
export declare function createWxMock(definition?: WxHostMock): WxHostMock;
|
|
127
|
+
export declare function applyWxMock(session: HeadlessSession, definition?: WxHostMock): void;
|
|
128
128
|
//#endregion
|
|
129
129
|
//#region src/matchers.d.ts
|
|
130
|
-
declare function toBeInTheMiniProgram(node: MiniProgramNode): MiniProgramMatcherResult;
|
|
131
|
-
declare function toHaveTextContent(node: MiniProgramNode, expected: string | RegExp): MiniProgramMatcherResult;
|
|
132
|
-
declare function toHaveEmitted(source: MiniProgramEmissionSource, eventName: string, expected?: unknown): MiniProgramMatcherResult;
|
|
133
|
-
declare function toHaveAttribute(node: MiniProgramNode, name: string, expected?: string): MiniProgramMatcherResult;
|
|
134
|
-
declare function toHaveDataset(node: MiniProgramNode, expected: Record<string, unknown>): MiniProgramMatcherResult;
|
|
135
|
-
declare const mpcoreMatchers: {
|
|
130
|
+
export declare function toBeInTheMiniProgram(node: MiniProgramNode): MiniProgramMatcherResult;
|
|
131
|
+
export declare function toHaveTextContent(node: MiniProgramNode, expected: string | RegExp): MiniProgramMatcherResult;
|
|
132
|
+
export declare function toHaveEmitted(source: MiniProgramEmissionSource, eventName: string, expected?: unknown): MiniProgramMatcherResult;
|
|
133
|
+
export declare function toHaveAttribute(node: MiniProgramNode, name: string, expected?: string): MiniProgramMatcherResult;
|
|
134
|
+
export declare function toHaveDataset(node: MiniProgramNode, expected: Record<string, unknown>): MiniProgramMatcherResult;
|
|
135
|
+
export declare const mpcoreMatchers: {
|
|
136
136
|
toBeInTheMiniProgram: typeof toBeInTheMiniProgram;
|
|
137
137
|
toHaveAttribute: typeof toHaveAttribute;
|
|
138
138
|
toHaveDataset: typeof toHaveDataset;
|
|
@@ -141,7 +141,7 @@ declare const mpcoreMatchers: {
|
|
|
141
141
|
};
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/project.d.ts
|
|
144
|
-
declare class MiniProgramTestProject {
|
|
144
|
+
export declare class MiniProgramTestProject {
|
|
145
145
|
private readonly options;
|
|
146
146
|
private readonly baseProject;
|
|
147
147
|
private readonly renders;
|
|
@@ -151,9 +151,9 @@ declare class MiniProgramTestProject {
|
|
|
151
151
|
renderComponent(componentPath: string, options?: RenderComponentOptions): Promise<MiniProgramRenderResult>;
|
|
152
152
|
close(): Promise<void>;
|
|
153
153
|
}
|
|
154
|
-
declare function artifactFromProject(projectPath: string): {
|
|
154
|
+
export declare function artifactFromProject(projectPath: string): {
|
|
155
155
|
projectPath: string;
|
|
156
156
|
};
|
|
157
|
-
declare function createTestProject(options: CreateTestProjectOptions): MiniProgramTestProject;
|
|
157
|
+
export declare function createTestProject(options: CreateTestProjectOptions): MiniProgramTestProject;
|
|
158
158
|
//#endregion
|
|
159
|
-
export {
|
|
159
|
+
export { type RoleQueryOptions, type TextMatcher, wechat };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpcore/test",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.8",
|
|
5
5
|
"description": "Testing Library-style utilities for compiled WeChat mini-program artifacts",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": "^20.19.0 || >=22.12.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@mpcore/simulator": "0.4.
|
|
41
|
+
"@mpcore/simulator": "0.4.3"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|