@wevu/test-utils 0.2.9 → 0.2.11
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/mount.d.mts +3 -3
- package/dist/mountComponent.d.mts +2 -3
- package/dist/types.d.mts +12 -13
- package/dist/vitest.d.mts +4 -5
- package/package.json +4 -4
package/dist/mount.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { mountComponent } from "./mountComponent.mjs";
|
|
|
4
4
|
type MountSubject<Bindings extends Record<string, any>, Props extends Record<string, any>> = TestSetupFunction<Bindings, Props> | {
|
|
5
5
|
setup?: TestSetupFunction<Bindings, Props>;
|
|
6
6
|
};
|
|
7
|
-
declare function mount<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>>(subject: MountSubject<Bindings, Props> | Record<string, any>, options?: MountOptions<Props, Data>): WevuTestWrapper<Bindings, Props, Data>;
|
|
8
|
-
declare function mountComposable<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>>(setup: TestSetupFunction<Bindings, Props>, options?: MountOptions<Props, Data>): WevuTestWrapper<Bindings, Props, Data>;
|
|
7
|
+
export declare function mount<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>>(subject: MountSubject<Bindings, Props> | Record<string, any>, options?: MountOptions<Props, Data>): WevuTestWrapper<Bindings, Props, Data>;
|
|
8
|
+
export declare function mountComposable<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>>(setup: TestSetupFunction<Bindings, Props>, options?: MountOptions<Props, Data>): WevuTestWrapper<Bindings, Props, Data>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export { mountComponent };
|
|
@@ -6,6 +6,5 @@ import { ComponentBindingsOf, ComponentMountOptions, ComponentPropsOf, WevuTestW
|
|
|
6
6
|
* @param component 编译后的 SFC 默认导出、组件选项或 Wevu 组件定义
|
|
7
7
|
* @param options 挂载选项
|
|
8
8
|
*/
|
|
9
|
-
declare function mountComponent<Component extends object, Props extends Record<string, any> = ComponentPropsOf<Component>, Data extends Record<string, any> = Record<string, any>>(component: Component, options?: ComponentMountOptions<Props>): WevuTestWrapper<ComponentBindingsOf<Component>, Props, Data>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { mountComponent };
|
|
9
|
+
export declare function mountComponent<Component extends object, Props extends Record<string, any> = ComponentPropsOf<Component>, Data extends Record<string, any> = Record<string, any>>(component: Component, options?: ComponentMountOptions<Props>): WevuTestWrapper<ComponentBindingsOf<Component>, Props, Data>;
|
|
10
|
+
//#endregion
|
package/dist/types.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentPropsOptions, CreateAppOptions, DefineComponentOptions, InternalRuntimeState, MiniProgramAdapter, RuntimeInstance, SetDataSnapshotOptions, SetupContext, WevuPlugin } from "wevu";
|
|
2
2
|
//#region src/types.d.ts
|
|
3
|
-
type TestSetupContext = SetupContext<any, any, any, ComponentPropsOptions>;
|
|
4
|
-
type TestSetupFunction<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>> = (props: Props, context: TestSetupContext) => Bindings | void;
|
|
5
|
-
type TestPlugin = WevuPlugin | readonly [WevuPlugin, ...any[]];
|
|
6
|
-
interface TestGlobalMountOptions {
|
|
3
|
+
export type TestSetupContext = SetupContext<any, any, any, ComponentPropsOptions>;
|
|
4
|
+
export type TestSetupFunction<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>> = (props: Props, context: TestSetupContext) => Bindings | void;
|
|
5
|
+
export type TestPlugin = WevuPlugin | readonly [WevuPlugin, ...any[]];
|
|
6
|
+
export interface TestGlobalMountOptions {
|
|
7
7
|
plugins?: TestPlugin[];
|
|
8
8
|
provide?: Map<any, unknown> | Record<PropertyKey, unknown>;
|
|
9
9
|
mocks?: Record<string, unknown>;
|
|
@@ -11,7 +11,7 @@ interface TestGlobalMountOptions {
|
|
|
11
11
|
globalProperties?: Record<string, unknown>;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
interface MountOptions<Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>> {
|
|
14
|
+
export interface MountOptions<Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>> {
|
|
15
15
|
props?: Props;
|
|
16
16
|
data?: Data | (() => Data);
|
|
17
17
|
computed?: CreateAppOptions['computed'];
|
|
@@ -23,24 +23,24 @@ interface MountOptions<Props extends Record<string, any> = Record<string, any>,
|
|
|
23
23
|
componentName?: string;
|
|
24
24
|
adapter?: Pick<MiniProgramAdapter, 'setData'>;
|
|
25
25
|
}
|
|
26
|
-
interface ComponentMountOptions<Props extends Record<string, any> = Record<string, any>> extends Omit<MountOptions<Props>, 'props' | 'data' | 'computed' | 'methods' | 'watch' | 'setData'> {
|
|
26
|
+
export interface ComponentMountOptions<Props extends Record<string, any> = Record<string, any>> extends Omit<MountOptions<Props>, 'props' | 'data' | 'computed' | 'methods' | 'watch' | 'setData'> {
|
|
27
27
|
props?: Partial<Props>;
|
|
28
28
|
componentName?: string;
|
|
29
29
|
}
|
|
30
|
-
type WevuComponentInput<Props extends Record<string, any> = Record<string, any>> = DefineComponentOptions<ComponentPropsOptions, any, any, any, any> | (new () => {
|
|
30
|
+
export type WevuComponentInput<Props extends Record<string, any> = Record<string, any>> = DefineComponentOptions<ComponentPropsOptions, any, any, any, any> | (new () => {
|
|
31
31
|
$props: Props;
|
|
32
32
|
} & Record<string, any>) | Record<string, any>;
|
|
33
33
|
type ComponentInstance<Component> = Component extends (abstract new (...args: any[]) => infer Instance) ? Instance : Record<string, any>;
|
|
34
|
-
type ComponentPropsOf<Component> = ComponentInstance<Component> extends {
|
|
34
|
+
export type ComponentPropsOf<Component> = ComponentInstance<Component> extends {
|
|
35
35
|
$props: infer Props;
|
|
36
36
|
} ? Props extends Record<string, any> ? Props : Record<string, any> : Component extends {
|
|
37
37
|
props: infer Props;
|
|
38
38
|
} ? Props extends ComponentPropsOptions ? import('wevu').InferProps<Props> : Record<string, any> : Record<string, any>;
|
|
39
|
-
type ComponentBindingsOf<Component> = ComponentInstance<Component> extends (infer Instance) ? Instance extends Record<string, any> ? Omit<Instance, '$props'> : Record<string, any> : Record<string, any>;
|
|
40
|
-
interface EmittedEventMap {
|
|
39
|
+
export type ComponentBindingsOf<Component> = ComponentInstance<Component> extends (infer Instance) ? Instance extends Record<string, any> ? Omit<Instance, '$props'> : Record<string, any> : Record<string, any>;
|
|
40
|
+
export interface EmittedEventMap {
|
|
41
41
|
[eventName: string]: unknown[][];
|
|
42
42
|
}
|
|
43
|
-
interface WevuTestWrapper<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>> {
|
|
43
|
+
export interface WevuTestWrapper<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>> {
|
|
44
44
|
readonly vm: Record<string, any> & Bindings & {
|
|
45
45
|
$props: Props;
|
|
46
46
|
};
|
|
@@ -55,5 +55,4 @@ interface WevuTestWrapper<Bindings extends Record<string, any> = Record<string,
|
|
|
55
55
|
nextTick: () => Promise<void>;
|
|
56
56
|
unmount: () => void;
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
|
-
export { ComponentBindingsOf, ComponentMountOptions, ComponentPropsOf, EmittedEventMap, MountOptions, TestGlobalMountOptions, TestPlugin, TestSetupContext, TestSetupFunction, WevuComponentInput, WevuTestWrapper };
|
|
58
|
+
//#endregion
|
package/dist/vitest.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/vitest.d.ts
|
|
2
|
-
interface WevuSfcPlugin {
|
|
2
|
+
export interface WevuSfcPlugin {
|
|
3
3
|
name: string;
|
|
4
4
|
enforce: 'pre';
|
|
5
5
|
resolveId: (this: {
|
|
@@ -17,7 +17,7 @@ interface WevuSfcPlugin {
|
|
|
17
17
|
map: any;
|
|
18
18
|
}>;
|
|
19
19
|
}
|
|
20
|
-
interface WevuSfcOptions {
|
|
20
|
+
export interface WevuSfcOptions {
|
|
21
21
|
isPage?: (filename: string) => boolean | Promise<boolean>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -25,6 +25,5 @@ interface WevuSfcOptions {
|
|
|
25
25
|
*
|
|
26
26
|
* 该插件只输出 SFC script,不加载 Vue Web runtime,也不渲染模板、样式或 WXML。
|
|
27
27
|
*/
|
|
28
|
-
declare function wevuSfc(options?: WevuSfcOptions): WevuSfcPlugin;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { WevuSfcOptions, WevuSfcPlugin, wevuSfc };
|
|
28
|
+
export declare function wevuSfc(options?: WevuSfcOptions): WevuSfcPlugin;
|
|
29
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wevu/test-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.11",
|
|
5
5
|
"description": "Lightweight test utilities for Wevu Composition API logic",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"node": "^20.19.0 || >=22.12.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"wevu": "7.0.
|
|
44
|
+
"wevu": "7.0.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@weapp-core/constants": "0.2.1",
|
|
48
|
-
"@wevu/compiler": "7.0.
|
|
48
|
+
"@wevu/compiler": "7.0.4"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"wevu": "7.0.
|
|
51
|
+
"wevu": "7.0.4"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public",
|