vitest-plugin-vis 2.4.4 → 3.0.0
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/esm/client/actions/has_image_snapshot_action.d.ts +4 -0
- package/esm/client/actions/has_image_snapshot_action.d.ts.map +1 -0
- package/esm/client/actions/has_image_snapshot_action.js +6 -0
- package/esm/client/actions/load_image_snapshot_results_action.d.ts +3 -0
- package/esm/client/actions/load_image_snapshot_results_action.d.ts.map +1 -0
- package/esm/client/actions/load_image_snapshot_results_action.js +3 -0
- package/esm/client/actions/match_image_snapshot_action.d.ts +6 -0
- package/esm/client/actions/match_image_snapshot_action.d.ts.map +1 -0
- package/esm/client/actions/match_image_snapshot_action.js +20 -0
- package/esm/client/actions/match_page_image_snapshot_action.d.ts +6 -0
- package/esm/client/actions/match_page_image_snapshot_action.d.ts.map +1 -0
- package/esm/client/actions/match_page_image_snapshot_action.js +9 -0
- package/esm/client/auto_snapshot_options.d.ts +29 -0
- package/esm/client/auto_snapshot_options.d.ts.map +1 -0
- package/esm/client/auto_snapshot_options.js +49 -0
- package/esm/client/compare_image_snapshot.d.ts +6 -0
- package/esm/client/compare_image_snapshot.d.ts.map +1 -0
- package/esm/client/compare_image_snapshot.js +52 -0
- package/esm/client/{image_snapshot_matcher.logic.d.ts → compare_image_snapshot.logic.d.ts} +1 -1
- package/esm/client/compare_image_snapshot.logic.d.ts.map +1 -0
- package/esm/client/expect/to_match_image_snapshot.d.ts.map +1 -1
- package/esm/client/expect/to_match_image_snapshot.js +4 -3
- package/esm/client/image_resizer.d.ts.map +1 -1
- package/esm/client/image_snapshot_options.d.ts +2 -0
- package/esm/client/image_snapshot_options.d.ts.map +1 -0
- package/esm/client/image_snapshot_options.js +6 -0
- package/esm/client/page/augment.d.ts +2 -1
- package/esm/client/page/augment.d.ts.map +1 -1
- package/esm/client/page/extend.js +2 -1
- package/esm/client/page/has_image_snapshot.d.ts +6 -6
- package/esm/client/page/has_image_snapshot.d.ts.map +1 -1
- package/esm/client/page/has_image_snapshot.js +2 -11
- package/esm/client/page/to_match_image_snapshot.d.ts +8 -0
- package/esm/client/page/to_match_image_snapshot.d.ts.map +1 -0
- package/esm/client/page/to_match_image_snapshot.js +15 -0
- package/esm/client/setup/create_vis.d.ts +96 -0
- package/esm/client/setup/create_vis.d.ts.map +1 -0
- package/esm/{setup → client/setup}/create_vis.js +43 -31
- package/esm/client/setup/vis.ctx.d.ts +12 -0
- package/esm/client/setup/vis.ctx.d.ts.map +1 -0
- package/esm/client/setup/vis.ctx.js +32 -0
- package/esm/client/setup/vis.d.ts +5 -0
- package/esm/client/setup/vis.d.ts.map +1 -0
- package/esm/client/should_take_snapshot.d.ts +2 -9
- package/esm/client/should_take_snapshot.d.ts.map +1 -1
- package/esm/client/should_take_snapshot.js +1 -11
- package/esm/client/snapshot_meta.d.ts +6 -0
- package/esm/client/snapshot_meta.d.ts.map +1 -0
- package/esm/client/task_id.d.ts +0 -3
- package/esm/client/task_id.d.ts.map +1 -1
- package/esm/client/task_id.js +0 -3
- package/esm/client/vitest_suite_proxy.d.ts +2 -9
- package/esm/client/vitest_suite_proxy.d.ts.map +1 -1
- package/esm/client-api.d.ts +11 -0
- package/esm/client-api.d.ts.map +1 -0
- package/esm/client-api.js +8 -0
- package/esm/commands.d.ts +0 -1
- package/esm/commands.d.ts.map +1 -1
- package/esm/commands.js +0 -1
- package/esm/config/types.d.ts +22 -22
- package/esm/config/types.d.ts.map +1 -1
- package/esm/config/vis.d.ts +4 -3
- package/esm/config/vis.d.ts.map +1 -1
- package/esm/config/vis.js +3 -4
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/presets/auto.d.ts +1 -2
- package/esm/presets/auto.d.ts.map +1 -1
- package/esm/presets/auto.js +8 -4
- package/esm/presets/enable.d.ts +1 -2
- package/esm/presets/enable.d.ts.map +1 -1
- package/esm/presets/enable.js +4 -4
- package/esm/presets/manual.d.ts +1 -2
- package/esm/presets/manual.d.ts.map +1 -1
- package/esm/presets/manual.js +3 -4
- package/esm/server/browser_provider/playwright.d.ts.map +1 -1
- package/esm/server/browser_provider/playwright.js +9 -3
- package/esm/server/browser_provider/types.d.ts +5 -1
- package/esm/server/browser_provider/types.d.ts.map +1 -1
- package/esm/server/browser_provider/webdriverio.d.ts.map +1 -1
- package/esm/server/browser_provider/webdriverio.js +7 -4
- package/esm/server/commands/augment.d.ts +11 -0
- package/esm/server/commands/augment.d.ts.map +1 -0
- package/esm/server/commands/augment.js +1 -0
- package/esm/server/commands/commands.d.ts +9 -0
- package/esm/server/commands/commands.d.ts.map +1 -0
- package/esm/server/commands/commands.js +14 -0
- package/esm/server/commands/has_image_snapshot.d.ts +2 -6
- package/esm/server/commands/has_image_snapshot.d.ts.map +1 -1
- package/esm/server/commands/has_image_snapshot.js +3 -3
- package/esm/server/commands/image_snapshot_next_index.d.ts +1 -1
- package/esm/server/commands/image_snapshot_next_index.d.ts.map +1 -1
- package/esm/server/commands/image_snapshot_next_index.js +2 -2
- package/esm/server/commands/load_image_snapshot_results.d.ts +21 -0
- package/esm/server/commands/load_image_snapshot_results.d.ts.map +1 -0
- package/esm/server/commands/load_image_snapshot_results.js +6 -0
- package/esm/server/commands/prepare_image_snapshot_comparison.d.ts +8 -10
- package/esm/server/commands/prepare_image_snapshot_comparison.d.ts.map +1 -1
- package/esm/server/commands/prepare_image_snapshot_comparison.js +11 -9
- package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts +35 -0
- package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts.map +1 -0
- package/esm/server/commands/prepare_page_image_snapshot_comparison.js +27 -0
- package/esm/server/commands/setup_vis_suite.d.ts +3 -3
- package/esm/server/commands/setup_vis_suite.d.ts.map +1 -1
- package/esm/server/commands/setup_vis_suite.js +2 -3
- package/esm/server/commands/types.d.ts +3 -0
- package/esm/server/commands/types.d.ts.map +1 -0
- package/esm/server/commands/types.js +1 -0
- package/esm/server/externals/file.d.ts +10 -0
- package/esm/server/externals/file.d.ts.map +1 -0
- package/esm/server/{file.js → externals/file.js} +12 -4
- package/esm/server/{commands/browser_command_context.d.ts → project.d.ts} +8 -3
- package/esm/server/project.d.ts.map +1 -0
- package/esm/server/{commands/browser_command_context.js → project.js} +2 -2
- package/esm/server/snapshot.d.ts +4 -5
- package/esm/server/snapshot.d.ts.map +1 -1
- package/esm/server/snapshot.js +15 -13
- package/esm/server/snapshot_path.d.ts +3 -3
- package/esm/server/snapshot_path.d.ts.map +1 -1
- package/esm/server/snapshot_path.js +12 -11
- package/esm/server/snapshot_writer.d.ts +13 -0
- package/esm/server/snapshot_writer.d.ts.map +1 -0
- package/esm/server/snapshot_writer.js +15 -0
- package/esm/server/suite.d.ts +53 -0
- package/esm/server/suite.d.ts.map +1 -0
- package/esm/server/suite.js +73 -0
- package/esm/server/vis_options.d.ts +18 -0
- package/esm/server/vis_options.d.ts.map +1 -0
- package/esm/server/vis_options.js +14 -0
- package/esm/server/vis_server_context.d.ts +50 -0
- package/esm/server/vis_server_context.d.ts.map +1 -0
- package/esm/server/{vis_context.ctx.d.ts → vis_server_context.deps.d.ts} +2 -2
- package/esm/server/vis_server_context.deps.d.ts.map +1 -0
- package/esm/server/{vis_context.ctx.js → vis_server_context.deps.js} +1 -1
- package/esm/server/vis_server_context.js +2 -0
- package/esm/server/{vis_context.logic.d.ts → vis_server_context.logic.d.ts} +12 -32
- package/esm/server/vis_server_context.logic.d.ts.map +1 -0
- package/esm/server/vis_server_context.logic.js +79 -0
- package/esm/server/{vis_context.types.d.ts → vis_server_context.types.d.ts} +6 -6
- package/esm/server/vis_server_context.types.d.ts.map +1 -0
- package/esm/server/vis_server_context.types.js +1 -0
- package/esm/server-utils.d.ts +3 -0
- package/esm/server-utils.d.ts.map +1 -0
- package/esm/server-utils.js +2 -0
- package/esm/setup.d.ts +2 -2
- package/esm/setup.d.ts.map +1 -1
- package/esm/setup.js +2 -2
- package/esm/shared/asserts.d.ts +2 -0
- package/esm/shared/asserts.d.ts.map +1 -0
- package/esm/shared/asserts.js +5 -0
- package/esm/shared/types.d.ts +22 -21
- package/esm/shared/types.d.ts.map +1 -1
- package/esm/testing/stubBrowserCommandContext.d.ts +1 -1
- package/esm/testing/stubBrowserCommandContext.d.ts.map +1 -1
- package/esm/testing/stubBrowserCommandContext.js +3 -13
- package/esm/testing/stubSuite.d.ts +10 -0
- package/esm/testing/stubSuite.d.ts.map +1 -0
- package/esm/testing/stubSuite.js +27 -0
- package/esm/testing/stubUserConfig.d.ts +7 -0
- package/esm/testing/stubUserConfig.d.ts.map +1 -0
- package/esm/testing/stubUserConfig.js +4 -0
- package/package.json +29 -28
- package/readme.md +409 -110
- package/src/client/actions/has_image_snapshot_action.ts +14 -0
- package/src/client/actions/load_image_snapshot_results_action.ts +5 -0
- package/src/client/actions/match_image_snapshot_action.ts +32 -0
- package/src/client/actions/match_page_image_snapshot_action.ts +20 -0
- package/src/client/auto_snapshot_options.ts +71 -0
- package/src/client/compare_image_snapshot.ts +84 -0
- package/src/client/expect/to_match_image_snapshot.ts +4 -3
- package/src/client/image_snapshot_options.ts +6 -0
- package/src/client/page/augment.ts +2 -1
- package/src/client/page/extend.ts +2 -1
- package/src/client/page/has_image_snapshot.ts +8 -21
- package/src/client/page/to_match_image_snapshot.ts +27 -0
- package/src/client/setup/create_vis.ts +227 -0
- package/src/client/setup/vis.ctx.ts +33 -0
- package/src/client/should_take_snapshot.ts +3 -13
- package/src/client/snapshot_meta.ts +7 -0
- package/src/client/task_id.ts +0 -3
- package/src/client/vitest_suite_proxy.ts +2 -5
- package/src/client-api.ts +11 -0
- package/src/commands.ts +0 -1
- package/src/config/types.ts +32 -27
- package/src/config/vis.ts +3 -5
- package/src/index.ts +1 -1
- package/src/presets/auto.ts +8 -4
- package/src/presets/enable.ts +4 -4
- package/src/presets/manual.ts +3 -4
- package/src/server/browser_provider/playwright.ts +9 -3
- package/src/server/browser_provider/types.ts +12 -1
- package/src/server/browser_provider/webdriverio.ts +7 -4
- package/src/server/commands/augment.ts +16 -0
- package/src/server/commands/commands.ts +15 -0
- package/src/server/commands/has_image_snapshot.ts +8 -6
- package/src/server/commands/image_snapshot_next_index.ts +5 -3
- package/src/server/commands/load_image_snapshot_results.ts +32 -0
- package/src/server/commands/prepare_image_snapshot_comparison.ts +20 -14
- package/src/server/commands/prepare_page_image_snapshot_comparison.ts +75 -0
- package/src/server/commands/setup_vis_suite.ts +17 -7
- package/src/server/commands/types.ts +9 -0
- package/src/server/externals/file.ts +21 -0
- package/src/server/{commands/browser_command_context.ts → project.ts} +2 -4
- package/src/server/snapshot.ts +23 -14
- package/src/server/snapshot_path.ts +15 -13
- package/src/server/snapshot_writer.ts +22 -0
- package/src/server/suite.ts +96 -0
- package/src/server/vis_options.ts +27 -0
- package/src/server/{vis_context.ctx.ts → vis_server_context.deps.ts} +1 -1
- package/src/server/vis_server_context.logic.ts +112 -0
- package/src/server/vis_server_context.ts +3 -0
- package/src/server/{vis_context.types.ts → vis_server_context.types.ts} +5 -5
- package/src/server-utils.ts +2 -0
- package/src/setup.ts +2 -2
- package/src/shared/asserts.ts +5 -0
- package/src/shared/types.ts +25 -23
- package/src/testing/stubBrowserCommandContext.ts +4 -14
- package/src/testing/stubSuite.ts +38 -0
- package/src/testing/stubUserConfig.ts +6 -0
- package/esm/client/image_snapshot_matcher.d.ts +0 -11
- package/esm/client/image_snapshot_matcher.d.ts.map +0 -1
- package/esm/client/image_snapshot_matcher.js +0 -80
- package/esm/client/image_snapshot_matcher.logic.d.ts.map +0 -1
- package/esm/client/snapshot_options.d.ts +0 -33
- package/esm/client/snapshot_options.d.ts.map +0 -1
- package/esm/client/snapshot_options.js +0 -37
- package/esm/client.d.ts +0 -8
- package/esm/client.d.ts.map +0 -1
- package/esm/client.js +0 -5
- package/esm/server/commands/browser_command_context.d.ts.map +0 -1
- package/esm/server/commands/extend.d.ts +0 -17
- package/esm/server/commands/extend.d.ts.map +0 -1
- package/esm/server/commands/extend.js +0 -12
- package/esm/server/commands/match_image_snapshot.d.ts +0 -18
- package/esm/server/commands/match_image_snapshot.d.ts.map +0 -1
- package/esm/server/commands/match_image_snapshot.js +0 -81
- package/esm/server/file.d.ts +0 -7
- package/esm/server/file.d.ts.map +0 -1
- package/esm/server/vis_context.ctx.d.ts.map +0 -1
- package/esm/server/vis_context.d.ts +0 -56
- package/esm/server/vis_context.d.ts.map +0 -1
- package/esm/server/vis_context.js +0 -2
- package/esm/server/vis_context.logic.d.ts.map +0 -1
- package/esm/server/vis_context.logic.js +0 -137
- package/esm/server/vis_context.types.d.ts.map +0 -1
- package/esm/setup/create_vis.d.ts +0 -53
- package/esm/setup/create_vis.d.ts.map +0 -1
- package/esm/setup/vis.d.ts +0 -5
- package/esm/setup/vis.d.ts.map +0 -1
- package/src/client/image_snapshot_matcher.ts +0 -121
- package/src/client/snapshot_options.ts +0 -82
- package/src/client.ts +0 -7
- package/src/server/commands/extend.ts +0 -25
- package/src/server/commands/match_image_snapshot.ts +0 -128
- package/src/server/file.ts +0 -13
- package/src/server/vis_context.logic.ts +0 -200
- package/src/server/vis_context.ts +0 -3
- package/src/setup/create_vis.ts +0 -154
- /package/esm/client/{image_snapshot_matcher.logic.js → compare_image_snapshot.logic.js} +0 -0
- /package/esm/{setup → client/setup}/vis.js +0 -0
- /package/esm/{server/vis_context.types.js → client/snapshot_meta.js} +0 -0
- /package/src/client/{image_snapshot_matcher.logic.ts → compare_image_snapshot.logic.ts} +0 -0
- /package/src/{setup → client/setup}/vis.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { assertSnapshotKeyWithoutDash } from "../shared/asserts.js";
|
|
2
|
+
import { getProjectName } from "./project.js";
|
|
3
|
+
const DEFAULT_PROJECT_NAME = '__default';
|
|
4
|
+
const visOptions = {};
|
|
5
|
+
export function setVisOption(userConfig, options) {
|
|
6
|
+
assertSnapshotKeyWithoutDash(options?.snapshotKey);
|
|
7
|
+
const name = userConfig.test?.name;
|
|
8
|
+
const id = name ?? DEFAULT_PROJECT_NAME;
|
|
9
|
+
visOptions[id] = options;
|
|
10
|
+
}
|
|
11
|
+
export function getVisOption(context) {
|
|
12
|
+
const id = getProjectName(context) ?? DEFAULT_PROJECT_NAME;
|
|
13
|
+
return visOptions[id] ?? {};
|
|
14
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const visServerContext: {
|
|
2
|
+
getSnapshotResults(browserContext: import("./vis_server_context.types.ts").PartialBrowserCommandContext, taskId: string): Promise<import("./commands/load_image_snapshot_results.ts").ImageSnapshotResult[]>;
|
|
3
|
+
getSnapshotInfo(browserContext: import("./vis_server_context.types.ts").PartialBrowserCommandContext, taskId: string, options?: import("../client-api.ts").ImageSnapshotKeyOptions): Promise<{
|
|
4
|
+
baselinePath: string;
|
|
5
|
+
resultPath: string;
|
|
6
|
+
diffPath: string;
|
|
7
|
+
comparisonMethod: any;
|
|
8
|
+
diffOptions?: Partial<import("ssim.js").Options> | undefined;
|
|
9
|
+
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
|
|
10
|
+
failureThreshold?: number | undefined | undefined;
|
|
11
|
+
timeout?: number | undefined | undefined;
|
|
12
|
+
} | {
|
|
13
|
+
baselinePath: string;
|
|
14
|
+
resultPath: string;
|
|
15
|
+
diffPath: string;
|
|
16
|
+
comparisonMethod?: any;
|
|
17
|
+
diffOptions?: {
|
|
18
|
+
threshold?: number | undefined;
|
|
19
|
+
includeAA?: boolean | undefined;
|
|
20
|
+
alpha?: number | undefined;
|
|
21
|
+
aaColor?: [number, number, number] | undefined;
|
|
22
|
+
diffColor?: [number, number, number] | undefined;
|
|
23
|
+
diffColorAlt?: [number, number, number] | undefined;
|
|
24
|
+
diffMask?: boolean | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
|
|
27
|
+
failureThreshold?: number | undefined | undefined;
|
|
28
|
+
timeout?: number | undefined | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
getTaskCount(browserContext: import("./vis_server_context.types.ts").PartialBrowserCommandContext, taskId: string): Promise<number>;
|
|
31
|
+
hasImageSnapshot(browserContext: import("./vis_server_context.types.ts").PartialBrowserCommandContext, taskId: string, snapshotKey: string | undefined): Promise<boolean>;
|
|
32
|
+
getSnapshotFilename(browserContext: import("./vis_server_context.types.ts").PartialBrowserCommandContext, info: {
|
|
33
|
+
taskId: string;
|
|
34
|
+
task: {
|
|
35
|
+
count: number;
|
|
36
|
+
};
|
|
37
|
+
}, snapshotKey: string | undefined): string;
|
|
38
|
+
getSuiteInfo(browserContext: import("./vis_server_context.types.ts").PartialBrowserCommandContext, taskId: string): Promise<{
|
|
39
|
+
projectRoot: string;
|
|
40
|
+
suiteId: string;
|
|
41
|
+
taskId: string;
|
|
42
|
+
baselineDir: string;
|
|
43
|
+
resultDir: string;
|
|
44
|
+
diffDir: string;
|
|
45
|
+
task: {
|
|
46
|
+
count: number;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=vis_server_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis_server_context.d.ts","sourceRoot":"","sources":["../../src/server/vis_server_context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA2B,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const deps: {
|
|
2
2
|
rimraf: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
3
3
|
rimraf: (path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>;
|
|
4
4
|
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
@@ -26,4 +26,4 @@ export declare const ctx: {
|
|
|
26
26
|
};
|
|
27
27
|
getSnapshotPlatform(): NodeJS.Platform | "local";
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=vis_server_context.deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis_server_context.deps.d.ts","sourceRoot":"","sources":["../../src/server/vis_server_context.deps.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;6CAOgsD,CAAC;2CAAkF,CAAC;iDAA8E,CAAC;8CAA2E,CAAC;+CAA0F,CAAC;;iDAAqF,CAAC;8CAA2E,CAAC;+CAA0F,CAAC;;iDAAqF,CAAC;6CAA0E,CAAC;+CAA0F,CAAC;;gDAAoF,CAAC;+CAA4E,CAAC;+CAA0F,CAAC;;kDAAsF,CAAC;kDAA+E,CAAC;+CAA0F,CAAC;;qDAAyF,CAAC;;;CAF5mG,CAAA"}
|
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__test__getState(context: PartialBrowserCommandContext): Promise<VisProjectState>;
|
|
8
|
-
/**
|
|
9
|
-
* Setup suite is called on each test file's beforeAll hook.
|
|
10
|
-
* Test files include vitest test files and storybook story files.
|
|
11
|
-
* It needs to make sure there is no race condition between the test files.
|
|
12
|
-
*/
|
|
13
|
-
setupSuite(browserContext: PartialBrowserCommandContext): Promise<import("type-plus").Pick._<VisProjectState, "subjectDataTestId">>;
|
|
14
|
-
getSnapshotInfo(browserContext: PartialBrowserCommandContext, name: string, isAutoSnapshot: boolean, options?: {
|
|
15
|
-
snapshotFileId?: string | undefined;
|
|
16
|
-
}): Promise<{
|
|
1
|
+
import type { ImageSnapshotKeyOptions } from '../client-api.ts';
|
|
2
|
+
import type { ImageSnapshotResult } from './commands/load_image_snapshot_results.ts';
|
|
3
|
+
import type { PartialBrowserCommandContext } from './vis_server_context.types.ts';
|
|
4
|
+
export declare function createVisServerContext(): {
|
|
5
|
+
getSnapshotResults(browserContext: PartialBrowserCommandContext, taskId: string): Promise<ImageSnapshotResult[]>;
|
|
6
|
+
getSnapshotInfo(browserContext: PartialBrowserCommandContext, taskId: string, options?: ImageSnapshotKeyOptions): Promise<{
|
|
17
7
|
baselinePath: string;
|
|
18
8
|
resultPath: string;
|
|
19
9
|
diffPath: string;
|
|
20
|
-
timeout?: number | undefined | undefined;
|
|
21
10
|
comparisonMethod: any;
|
|
22
|
-
diffOptions?: Partial<import("ssim.js").Options> | undefined;
|
|
11
|
+
diffOptions?: Partial<import("ssim.js/dist/types.js").Options> | undefined;
|
|
23
12
|
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
|
|
24
13
|
failureThreshold?: number | undefined | undefined;
|
|
14
|
+
timeout?: number | undefined | undefined;
|
|
25
15
|
} | {
|
|
26
16
|
baselinePath: string;
|
|
27
17
|
resultPath: string;
|
|
28
18
|
diffPath: string;
|
|
29
|
-
timeout?: number | undefined | undefined;
|
|
30
19
|
comparisonMethod?: any;
|
|
31
20
|
diffOptions?: {
|
|
32
21
|
threshold?: number | undefined;
|
|
@@ -39,15 +28,16 @@ export declare function createVisContext(): {
|
|
|
39
28
|
} | undefined;
|
|
40
29
|
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
|
|
41
30
|
failureThreshold?: number | undefined | undefined;
|
|
31
|
+
timeout?: number | undefined | undefined;
|
|
42
32
|
}>;
|
|
43
33
|
getTaskCount(browserContext: PartialBrowserCommandContext, taskId: string): Promise<number>;
|
|
44
|
-
hasImageSnapshot(browserContext: PartialBrowserCommandContext, taskId: string,
|
|
34
|
+
hasImageSnapshot(browserContext: PartialBrowserCommandContext, taskId: string, snapshotKey: string | undefined): Promise<boolean>;
|
|
45
35
|
getSnapshotFilename(browserContext: PartialBrowserCommandContext, info: {
|
|
46
36
|
taskId: string;
|
|
47
37
|
task: {
|
|
48
38
|
count: number;
|
|
49
39
|
};
|
|
50
|
-
},
|
|
40
|
+
}, snapshotKey: string | undefined): string;
|
|
51
41
|
getSuiteInfo(browserContext: PartialBrowserCommandContext, taskId: string): Promise<{
|
|
52
42
|
projectRoot: string;
|
|
53
43
|
suiteId: string;
|
|
@@ -60,14 +50,4 @@ export declare function createVisContext(): {
|
|
|
60
50
|
};
|
|
61
51
|
}>;
|
|
62
52
|
};
|
|
63
|
-
|
|
64
|
-
suiteId: string;
|
|
65
|
-
suite: {
|
|
66
|
-
baselineDir: string;
|
|
67
|
-
resultDir: string;
|
|
68
|
-
diffDir: string;
|
|
69
|
-
tasks: {};
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
export declare function getSuiteId(state: VisProjectState, testPath: string, options: Pick<VisOptions, 'customizeSnapshotSubpath'>): string;
|
|
73
|
-
//# sourceMappingURL=vis_context.logic.d.ts.map
|
|
53
|
+
//# sourceMappingURL=vis_server_context.logic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis_server_context.logic.d.ts","sourceRoot":"","sources":["../../src/server/vis_server_context.logic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAIpF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAEjF,wBAAgB,sBAAsB;uCAEK,4BAA4B,UAAU,MAAM;oCA2BpE,4BAA4B,UACpC,MAAM,YACJ,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA2BC,4BAA4B,UAAU,MAAM;qCAI9D,4BAA4B,UACpC,MAAM,eACD,MAAM,GAAG,SAAS;wCASf,4BAA4B,QACtC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,eACpC,MAAM,GAAG,SAAS;iCASG,4BAA4B,UAAU,MAAM;;;;;;;;;;;EAkBhF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { basename, join, resolve } from 'pathe';
|
|
2
|
+
import { pick } from 'type-plus';
|
|
3
|
+
import { file } from "./externals/file.js";
|
|
4
|
+
import { getSuite, getTaskSubpath } from "./suite.js";
|
|
5
|
+
import { getVisOption } from "./vis_options.js";
|
|
6
|
+
export function createVisServerContext() {
|
|
7
|
+
const context = {
|
|
8
|
+
async getSnapshotResults(browserContext, taskId) {
|
|
9
|
+
const suiteInfo = await context.getSuiteInfo(browserContext, taskId);
|
|
10
|
+
const baselines = await file.glob(join(suiteInfo.projectRoot, suiteInfo.baselineDir, `${suiteInfo.taskId}-*.png`));
|
|
11
|
+
const results = await file.glob(join(suiteInfo.projectRoot, suiteInfo.resultDir, `${suiteInfo.taskId}-*.png`));
|
|
12
|
+
const diffs = await file.glob(join(suiteInfo.projectRoot, suiteInfo.diffDir, `${suiteInfo.taskId}-*.png`));
|
|
13
|
+
const r = [];
|
|
14
|
+
await Promise.all(baselines.map(async (baselinePath) => {
|
|
15
|
+
const filename = basename(baselinePath);
|
|
16
|
+
const resultPath = results.find((r) => r.endsWith(filename));
|
|
17
|
+
const diffPath = diffs.find((d) => d.endsWith(filename));
|
|
18
|
+
const baselineBuffer = await file.tryReadFile(baselinePath);
|
|
19
|
+
const resultBuffer = await file.tryReadFile(resultPath);
|
|
20
|
+
const diffBuffer = await file.tryReadFile(diffPath);
|
|
21
|
+
r.push({
|
|
22
|
+
filename,
|
|
23
|
+
baseline: baselineBuffer?.toString('base64'),
|
|
24
|
+
result: resultBuffer?.toString('base64'),
|
|
25
|
+
diff: diffBuffer?.toString('base64'),
|
|
26
|
+
});
|
|
27
|
+
}));
|
|
28
|
+
return r;
|
|
29
|
+
},
|
|
30
|
+
async getSnapshotInfo(browserContext, taskId, options) {
|
|
31
|
+
const suiteInfo = await context.getSuiteInfo(browserContext, taskId);
|
|
32
|
+
const snapshotFilename = context.getSnapshotFilename(browserContext, suiteInfo, options?.snapshotKey);
|
|
33
|
+
const { baselineDir, resultDir, diffDir, task } = suiteInfo;
|
|
34
|
+
task.count = task.count + 1;
|
|
35
|
+
const baselinePath = join(baselineDir, snapshotFilename);
|
|
36
|
+
const resultPath = join(resultDir, snapshotFilename);
|
|
37
|
+
const diffPath = join(diffDir, snapshotFilename);
|
|
38
|
+
return {
|
|
39
|
+
...pick(getVisOption(browserContext), 'comparisonMethod', 'diffOptions', 'failureThreshold', 'failureThresholdType', 'timeout'),
|
|
40
|
+
baselinePath,
|
|
41
|
+
resultPath,
|
|
42
|
+
diffPath,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
async getTaskCount(browserContext, taskId) {
|
|
46
|
+
return (await context.getSuiteInfo(browserContext, taskId)).task.count;
|
|
47
|
+
},
|
|
48
|
+
async hasImageSnapshot(browserContext, taskId, snapshotKey) {
|
|
49
|
+
const info = await context.getSuiteInfo(browserContext, taskId);
|
|
50
|
+
return file.existFile(resolve(info.projectRoot, info.baselineDir, context.getSnapshotFilename(browserContext, info, snapshotKey)));
|
|
51
|
+
},
|
|
52
|
+
getSnapshotFilename(browserContext, info, snapshotKey) {
|
|
53
|
+
if (snapshotKey)
|
|
54
|
+
return `${info.taskId}-${snapshotKey}.png`;
|
|
55
|
+
const visOptions = getVisOption(browserContext);
|
|
56
|
+
if (typeof visOptions.snapshotKey === 'string') {
|
|
57
|
+
return `${info.taskId}-${visOptions.snapshotKey}.png`;
|
|
58
|
+
}
|
|
59
|
+
return `${info.taskId}-${info.task.count}.png`;
|
|
60
|
+
},
|
|
61
|
+
async getSuiteInfo(browserContext, taskId) {
|
|
62
|
+
const projectState = await getSuite(browserContext);
|
|
63
|
+
const visOptions = getVisOption(browserContext);
|
|
64
|
+
const moduleId = getTaskSubpath(projectState, browserContext.testPath, visOptions);
|
|
65
|
+
const m = projectState.modules[moduleId];
|
|
66
|
+
const task = (m.tasks[taskId] = m.tasks[taskId] ?? { count: 1 });
|
|
67
|
+
return {
|
|
68
|
+
projectRoot: projectState.projectRoot,
|
|
69
|
+
suiteId: moduleId,
|
|
70
|
+
taskId,
|
|
71
|
+
baselineDir: m.baselineDir,
|
|
72
|
+
resultDir: m.resultDir,
|
|
73
|
+
diffDir: m.diffDir,
|
|
74
|
+
task,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
return context;
|
|
79
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type
|
|
2
|
-
[projectPath: string]: Promise<
|
|
1
|
+
export type VisSuites = {
|
|
2
|
+
[projectPath: string]: Promise<VisSuite>;
|
|
3
3
|
};
|
|
4
|
-
export type
|
|
4
|
+
export type VisSuite = {
|
|
5
5
|
projectRoot: string;
|
|
6
6
|
testTimeout: number;
|
|
7
7
|
hookTimeout: number;
|
|
@@ -10,8 +10,8 @@ export type VisProjectState = {
|
|
|
10
10
|
snapshotResultDir: string;
|
|
11
11
|
snapshotDiffDir: string;
|
|
12
12
|
snapshotRootPath: string;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
subject: string | undefined;
|
|
14
|
+
modules: Record<string, {
|
|
15
15
|
baselineDir: string;
|
|
16
16
|
resultDir: string;
|
|
17
17
|
diffDir: string;
|
|
@@ -50,4 +50,4 @@ export type PartialBrowserCommandContext = {
|
|
|
50
50
|
};
|
|
51
51
|
testPath: string;
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=
|
|
53
|
+
//# sourceMappingURL=vis_server_context.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vis_server_context.types.d.ts","sourceRoot":"","sources":["../../src/server/vis_server_context.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACvB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,OAAO,EAAE,MAAM,CACd,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAA;QACnB,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,MAAM,CACZ,MAAM,EACN;YACC,KAAK,EAAE,MAAM,CAAA;SACb,CACD,CAAA;KACD,CACD,CAAA;CACD,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IAC1C,OAAO,EAAE;QACR,MAAM,EAAE;YACP,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;YACZ,eAAe,EAAE;gBAChB,cAAc,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;aACtC,CAAA;YACD,WAAW,EAAE,MAAM,CAAA;YACnB,WAAW,EAAE,MAAM,CAAA;SACnB,CAAA;QACD,IAAI,EAAE;YACL,MAAM,EAAE;gBACP,IAAI,CAAC,EAAE;oBACN,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;iBACzB,CAAA;aACD,CAAA;SACD,CAAA;KACD,CAAA;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAChC,OAAO,CAAC,EAAE;YACT,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;YAC9B,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;YACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;SACxC,CAAA;KACD,CAAA;IACD,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../src/server-utils.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA"}
|
package/esm/setup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './client/expect/extend.ts';
|
|
2
2
|
import './client/page/extend.ts';
|
|
3
|
-
export * from './setup/vis.ts';
|
|
4
|
-
export * from './setup/create_vis.ts';
|
|
3
|
+
export * from './client/setup/vis.ts';
|
|
4
|
+
export * from './client/setup/create_vis.ts';
|
|
5
5
|
//# sourceMappingURL=setup.d.ts.map
|
package/esm/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA;AAClC,OAAO,yBAAyB,CAAA;AAEhC,cAAc,
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA;AAClC,OAAO,yBAAyB,CAAA;AAEhC,cAAc,uBAAuB,CAAA;AAIrC,cAAc,8BAA8B,CAAA"}
|
package/esm/setup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// `vitest-plugin-vis/setup` provides code needed in `vitest.setup.ts`.
|
|
2
2
|
import "./client/expect/extend.js";
|
|
3
3
|
import "./client/page/extend.js";
|
|
4
|
-
export * from "./setup/vis.js";
|
|
4
|
+
export * from "./client/setup/vis.js";
|
|
5
5
|
// This is exported for main/app boundary separation
|
|
6
6
|
// They can co-exist in the same export file thanks to ESM.
|
|
7
|
-
export * from "./setup/create_vis.js";
|
|
7
|
+
export * from "./client/setup/create_vis.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asserts.d.ts","sourceRoot":"","sources":["../../src/shared/asserts.ts"],"names":[],"mappings":"AAAA,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,QAI3E"}
|
package/esm/shared/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type pixelMatch from 'pixelmatch';
|
|
2
|
-
import type { Options as
|
|
2
|
+
import type { Options as SsimDiffOptions } from 'ssim.js';
|
|
3
|
+
import type { SnapshotMeta } from '../client/snapshot_meta.ts';
|
|
4
|
+
import type { NAME } from './constants.ts';
|
|
3
5
|
export interface ImageSnapshotTimeoutOptions {
|
|
4
6
|
/**
|
|
5
7
|
* Timeout for taking the snapshot.
|
|
@@ -8,18 +10,11 @@ export interface ImageSnapshotTimeoutOptions {
|
|
|
8
10
|
*/
|
|
9
11
|
timeout?: number | undefined;
|
|
10
12
|
}
|
|
11
|
-
export interface
|
|
13
|
+
export interface ImageSnapshotKeyOptions {
|
|
12
14
|
/**
|
|
13
|
-
* Customize the
|
|
14
|
-
*
|
|
15
|
-
* @param id The id of the snapshot.
|
|
16
|
-
* @param index The index of the snapshot.
|
|
15
|
+
* Customize the `snapshotKey` of the snapshot.
|
|
17
16
|
*/
|
|
18
|
-
|
|
19
|
-
id: string;
|
|
20
|
-
index: number;
|
|
21
|
-
isAutoSnapshot: boolean;
|
|
22
|
-
}) => string;
|
|
17
|
+
snapshotKey?: string | undefined;
|
|
23
18
|
}
|
|
24
19
|
export type ComparisonMethod = 'pixel' | 'ssim';
|
|
25
20
|
export type FailureThresholdOptions = {
|
|
@@ -41,34 +36,40 @@ export type SsimComparisonOptions<M = 'ssim'> = {
|
|
|
41
36
|
/**
|
|
42
37
|
* Custom options passed to 'ssim'
|
|
43
38
|
*/
|
|
44
|
-
diffOptions?: Partial<
|
|
39
|
+
diffOptions?: Partial<SsimDiffOptions> | undefined;
|
|
45
40
|
};
|
|
41
|
+
export type { SsimDiffOptions };
|
|
46
42
|
export type PixelComparisonOptions<M = 'pixel'> = {
|
|
47
43
|
comparisonMethod?: M | undefined;
|
|
48
44
|
/**
|
|
49
45
|
* Custom options passed to 'pixelmatch'
|
|
50
46
|
*/
|
|
51
|
-
diffOptions?:
|
|
47
|
+
diffOptions?: PixelDiffOptions | undefined;
|
|
52
48
|
};
|
|
49
|
+
export type PixelDiffOptions = Parameters<typeof pixelMatch>[5];
|
|
53
50
|
export type ImageSnapshotCompareOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim' ? SsimComparisonOptions<M> : PixelComparisonOptions<M>) & FailureThresholdOptions;
|
|
54
|
-
export type
|
|
51
|
+
export type ImageSnapshotSubjectOptions = {
|
|
55
52
|
/**
|
|
56
|
-
* Specify the
|
|
53
|
+
* Specify the query of the subject element.
|
|
57
54
|
*
|
|
58
|
-
* If the test does not have an element with the specified
|
|
55
|
+
* If the test does not have an element with the specified query,
|
|
59
56
|
* the `body` element will be used.
|
|
60
57
|
*/
|
|
61
|
-
|
|
58
|
+
subject?: string | undefined;
|
|
62
59
|
};
|
|
63
|
-
export type ToMatchImageSnapshotOptions<M extends ComparisonMethod = 'pixel'> = ImageSnapshotTimeoutOptions &
|
|
60
|
+
export type ToMatchImageSnapshotOptions<M extends ComparisonMethod = 'pixel'> = ImageSnapshotTimeoutOptions & ImageSnapshotKeyOptions & ImageSnapshotCompareOptions<M> & {
|
|
64
61
|
/**
|
|
65
62
|
* Expect the matcher to fail.
|
|
66
63
|
* If it passes, it will throw an error with details.
|
|
67
64
|
*/
|
|
68
65
|
expectToFail?: boolean | undefined;
|
|
69
66
|
};
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
export interface PageImageSnapshotOptions {
|
|
68
|
+
fullPage?: boolean | undefined;
|
|
69
|
+
}
|
|
70
|
+
export type SnapshotTestMeta = {
|
|
71
|
+
meta: {
|
|
72
|
+
[NAME]?: SnapshotMeta<ComparisonMethod>;
|
|
73
|
+
};
|
|
73
74
|
};
|
|
74
75
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACvC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/C,MAAM,MAAM,uBAAuB,GAAG;IACrC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IACtD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,MAAM,IAAI;IAC/C,gBAAgB,EAAE,CAAC,CAAA;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;CAClD,CAAA;AAED,YAAY,EAAE,eAAe,EAAE,CAAA;AAE/B,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAAI;IACjD,gBAAgB,CAAC,EAAE,CAAC,GAAG,SAAS,CAAA;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;AAE/D,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,IAAI,CAAC,CAAC,SAAS,MAAM,GAC9F,qBAAqB,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAC5B,uBAAuB,CAAA;AAExB,MAAM,MAAM,2BAA2B,GAAG;IACzC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,CAAA;AACD,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,IAAI,2BAA2B,GAC1G,uBAAuB,GACvB,2BAA2B,CAAC,CAAC,CAAC,GAAG;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAClC,CAAA;AAEF,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE;QACL,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAA;KACvC,CAAA;CACD,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BrowserCommandContext } from 'vitest/node';
|
|
2
|
-
import type { PartialBrowserCommandContext } from '../server/
|
|
2
|
+
import type { PartialBrowserCommandContext } from '../server/vis_server_context.types.ts';
|
|
3
3
|
export declare const stubBrowserCommandContext: (stub?: import("type-plus").RecursivePartial<BrowserCommandContext> | undefined) => BrowserCommandContext;
|
|
4
4
|
export declare function createStubPartialBrowserCommandContext({ root, testPath }: {
|
|
5
5
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubBrowserCommandContext.d.ts","sourceRoot":"","sources":["../../src/testing/stubBrowserCommandContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stubBrowserCommandContext.d.ts","sourceRoot":"","sources":["../../src/testing/stubBrowserCommandContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAA;AAEzF,eAAO,MAAM,yBAAyB,2GAAwC,CAAA;AAE9E,wBAAgB,sCAAsC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,2HAS5G"}
|
|
@@ -3,20 +3,10 @@ export const stubBrowserCommandContext = stub.build({});
|
|
|
3
3
|
export function createStubPartialBrowserCommandContext({ root, testPath }) {
|
|
4
4
|
return stub.build({
|
|
5
5
|
project: {
|
|
6
|
-
config: {
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
vite: {
|
|
10
|
-
config: {
|
|
11
|
-
test: {
|
|
12
|
-
name: 'subject',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
provider: {
|
|
18
|
-
options: {},
|
|
6
|
+
config: { root },
|
|
7
|
+
vite: { config: { test: { name: 'subject' } } },
|
|
19
8
|
},
|
|
9
|
+
provider: { options: {} },
|
|
20
10
|
testPath,
|
|
21
11
|
});
|
|
22
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type RecursivePartial } from 'type-plus';
|
|
2
|
+
import type { UserConfig } from 'vite';
|
|
3
|
+
import type { BrowserCommandContext } from 'vitest/node';
|
|
4
|
+
export declare function stubSuite(partialUserConfig?: RecursivePartial<UserConfig>, partialBrowserCommandContext?: RecursivePartial<BrowserCommandContext>): {
|
|
5
|
+
userConfig: UserConfig & {
|
|
6
|
+
configFile: string;
|
|
7
|
+
};
|
|
8
|
+
browserCommandContext: BrowserCommandContext;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=stubSuite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubSuite.d.ts","sourceRoot":"","sources":["../../src/testing/stubSuite.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAIxD,wBAAgB,SAAS,CACxB,iBAAiB,GAAE,gBAAgB,CAAC,UAAU,CAAM,EACpD,4BAA4B,GAAE,gBAAgB,CAAC,qBAAqB,CAAM;;;;;EA4B1E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { resolve } from 'pathe';
|
|
2
|
+
import { requiredDeep } from 'type-plus';
|
|
3
|
+
import { stubBrowserCommandContext } from "./stubBrowserCommandContext.js";
|
|
4
|
+
import { stubUserConfig } from "./stubUserConfig.js";
|
|
5
|
+
export function stubSuite(partialUserConfig = {}, partialBrowserCommandContext = {}) {
|
|
6
|
+
const root = resolve(import.meta.dirname, '../..');
|
|
7
|
+
const userConfig = stubUserConfig({
|
|
8
|
+
root,
|
|
9
|
+
...partialUserConfig,
|
|
10
|
+
});
|
|
11
|
+
const browserCommandContext = stubBrowserCommandContext(requiredDeep({
|
|
12
|
+
project: {
|
|
13
|
+
config: { root },
|
|
14
|
+
vite: {
|
|
15
|
+
config: {
|
|
16
|
+
test: {
|
|
17
|
+
name: partialUserConfig.test?.name,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}, partialBrowserCommandContext));
|
|
23
|
+
return {
|
|
24
|
+
userConfig,
|
|
25
|
+
browserCommandContext,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite';
|
|
2
|
+
export declare const stubUserConfig: (stub?: import("type-plus").RecursivePartial<UserConfig & {
|
|
3
|
+
configFile: string;
|
|
4
|
+
}> | undefined) => UserConfig & {
|
|
5
|
+
configFile: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=stubUserConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubUserConfig.d.ts","sourceRoot":"","sources":["../../src/testing/stubUserConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,eAAO,MAAM,cAAc;gBAAyC,MAAM;;gBAAN,MAAM;CAEvE,CAAA"}
|