vitest-plugin-vis 3.5.1 → 4.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/dist/asserts--HSSlgPD.mjs +8 -0
- package/dist/asserts--HSSlgPD.mjs.map +1 -0
- package/dist/augment-BJmy1S7i.d.mts +31 -0
- package/dist/augment-BJmy1S7i.d.mts.map +1 -0
- package/dist/auto_snapshot_options-CAD43Zkp.mjs +90 -0
- package/dist/auto_snapshot_options-CAD43Zkp.mjs.map +1 -0
- package/dist/auto_snapshot_options-CaQCXDdi.d.mts +45 -0
- package/dist/auto_snapshot_options-CaQCXDdi.d.mts.map +1 -0
- package/dist/base64-CHSENEAO.mjs +8 -0
- package/dist/base64-CHSENEAO.mjs.map +1 -0
- package/dist/client-api.d.mts +141 -0
- package/dist/client-api.d.mts.map +1 -0
- package/dist/client-api.mjs +14 -0
- package/dist/client-api.mjs.map +1 -0
- package/dist/config.d.mts +28 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +412 -0
- package/dist/config.mjs.map +1 -0
- package/dist/constants-CTBaz8Ml.mjs +10 -0
- package/dist/constants-CTBaz8Ml.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +6 -0
- package/dist/presets/auto.d.mts +1 -0
- package/dist/presets/auto.mjs +19 -0
- package/dist/presets/auto.mjs.map +1 -0
- package/dist/presets/enable.d.mts +1 -0
- package/dist/presets/enable.mjs +15 -0
- package/dist/presets/enable.mjs.map +1 -0
- package/dist/presets/manual.d.mts +1 -0
- package/dist/presets/manual.mjs +15 -0
- package/dist/presets/manual.mjs.map +1 -0
- package/dist/server-utils.d.mts +19 -0
- package/dist/server-utils.d.mts.map +1 -0
- package/dist/server-utils.mjs +4 -0
- package/dist/setup-BWgIDtv-.mjs +141 -0
- package/dist/setup-BWgIDtv-.mjs.map +1 -0
- package/dist/setup.d.mts +110 -0
- package/dist/setup.d.mts.map +1 -0
- package/dist/setup.mjs +8 -0
- package/dist/setup_vis_suite-C6JGGT7B.d.mts +17 -0
- package/dist/setup_vis_suite-C6JGGT7B.d.mts.map +1 -0
- package/dist/snapshot_path-7GliOSH_.mjs +58 -0
- package/dist/snapshot_path-7GliOSH_.mjs.map +1 -0
- package/dist/src-CSQnlFa9.mjs +1 -0
- package/dist/task_id-DnS9_4Ub.mjs +316 -0
- package/dist/task_id-DnS9_4Ub.mjs.map +1 -0
- package/dist/testing.d.mts +12 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +65550 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/to_match_image_snapshot.types-p-zilA_M.d.mts +9 -0
- package/dist/to_match_image_snapshot.types-p-zilA_M.d.mts.map +1 -0
- package/dist/trim_common_folder-ModiubEJ.d.mts +9 -0
- package/dist/trim_common_folder-ModiubEJ.d.mts.map +1 -0
- package/dist/types-DFb23VE1.d.mts +110 -0
- package/dist/types-DFb23VE1.d.mts.map +1 -0
- package/dist/types-Do1N7g4c.d.mts +63 -0
- package/dist/types-Do1N7g4c.d.mts.map +1 -0
- package/dist/vis_server_context.types-Ce1f9vOO.d.mts +1 -0
- package/package.json +55 -39
- package/readme.md +58 -6
- package/src/client/actions/match_image_snapshot_action.ts +1 -1
- package/src/client/actions/match_page_image_snapshot_action.ts +1 -1
- package/src/client/auto_snapshot_options.ts +16 -1
- package/src/client/compare_image_snapshot.ts +1 -1
- package/src/client/expect/to_match_image_snapshot.ts +1 -1
- package/src/client/page/extend.ts +1 -1
- package/src/client/page/has_image_snapshot.mdx +1 -1
- package/src/client/page/has_image_snapshot.ts +1 -1
- package/src/client/page/to_match_image_snapshot.mdx +1 -1
- package/src/client/page/to_match_image_snapshot.ts +1 -1
- package/src/client/setup/create_vis.ts +16 -14
- package/src/client/setup/vis.ctx.ts +4 -3
- package/src/client/setup/vis.ts +1 -1
- package/src/client/snapshot_meta.ts +5 -0
- package/src/client/vitest_browser_context_proxy.ts +3 -3
- package/src/config/vis.ts +4 -4
- package/src/server/browser_provider/browser_api.ts +2 -2
- package/src/server/browser_provider/playwright.ts +6 -4
- package/src/server/browser_provider/webdriverio.ts +3 -3
- package/src/server/commands/_assertions.ts +3 -3
- package/src/server/commands/augment.ts +1 -1
- package/src/server/commands/has_image_snapshot.ts +2 -2
- package/src/server/commands/image_snapshot_next_index.ts +2 -2
- package/src/server/commands/load_image_snapshot_results.ts +2 -3
- package/src/server/commands/prepare_image_snapshot_comparison.ts +2 -2
- package/src/server/commands/prepare_page_image_snapshot_comparison.ts +2 -2
- package/src/server/commands/setup_vis_suite.ts +3 -3
- package/src/server/project.ts +8 -7
- package/src/server/snapshot.ts +4 -4
- package/src/server/snapshot_path.ts +6 -5
- package/src/server/suite.ts +7 -12
- package/src/server/testing/stubBrowserCommandContext.ts +16 -0
- package/src/{testing → server/testing}/stubSuite.ts +7 -9
- package/src/server/testing/stubUserConfig.ts +6 -0
- package/src/server/vis_options.ts +4 -5
- package/src/server/vis_server_context.logic.ts +7 -7
- package/src/server/vis_server_context.types.ts +31 -26
- package/src/shared/types.ts +2 -0
- package/src/testing.ts +0 -1
- package/esm/client/actions/has_image_snapshot_action.d.ts +0 -4
- package/esm/client/actions/has_image_snapshot_action.d.ts.map +0 -1
- package/esm/client/actions/has_image_snapshot_action.js +0 -6
- package/esm/client/actions/load_image_snapshot_results_action.d.ts +0 -3
- package/esm/client/actions/load_image_snapshot_results_action.d.ts.map +0 -1
- package/esm/client/actions/load_image_snapshot_results_action.js +0 -3
- package/esm/client/actions/match_image_snapshot_action.d.ts +0 -6
- package/esm/client/actions/match_image_snapshot_action.d.ts.map +0 -1
- package/esm/client/actions/match_image_snapshot_action.js +0 -20
- package/esm/client/actions/match_page_image_snapshot_action.d.ts +0 -6
- package/esm/client/actions/match_page_image_snapshot_action.d.ts.map +0 -1
- package/esm/client/actions/match_page_image_snapshot_action.js +0 -9
- package/esm/client/align_images.d.ts +0 -2
- package/esm/client/align_images.d.ts.map +0 -1
- package/esm/client/align_images.js +0 -10
- package/esm/client/auto_snapshot_options.d.ts +0 -29
- package/esm/client/auto_snapshot_options.d.ts.map +0 -1
- package/esm/client/auto_snapshot_options.js +0 -49
- package/esm/client/compare_image_snapshot.d.ts +0 -6
- package/esm/client/compare_image_snapshot.d.ts.map +0 -1
- package/esm/client/compare_image_snapshot.js +0 -52
- package/esm/client/compare_image_snapshot.logic.d.ts +0 -3
- package/esm/client/compare_image_snapshot.logic.d.ts.map +0 -1
- package/esm/client/compare_image_snapshot.logic.js +0 -12
- package/esm/client/ctx.d.ts +0 -7
- package/esm/client/ctx.d.ts.map +0 -1
- package/esm/client/ctx.js +0 -11
- package/esm/client/expect/augment.d.ts +0 -8
- package/esm/client/expect/augment.d.ts.map +0 -1
- package/esm/client/expect/augment.js +0 -1
- package/esm/client/expect/expectation_result.d.ts +0 -3
- package/esm/client/expect/expectation_result.d.ts.map +0 -1
- package/esm/client/expect/expectation_result.js +0 -5
- package/esm/client/expect/extend.d.ts +0 -2
- package/esm/client/expect/extend.d.ts.map +0 -1
- package/esm/client/expect/extend.js +0 -4
- package/esm/client/expect/to_match_image_snapshot.d.ts +0 -9
- package/esm/client/expect/to_match_image_snapshot.d.ts.map +0 -1
- package/esm/client/expect/to_match_image_snapshot.js +0 -21
- package/esm/client/expect/to_match_image_snapshot.types.d.ts +0 -5
- package/esm/client/expect/to_match_image_snapshot.types.d.ts.map +0 -1
- package/esm/client/expect/to_match_image_snapshot.types.js +0 -1
- package/esm/client/image_data.d.ts +0 -3
- package/esm/client/image_data.d.ts.map +0 -1
- package/esm/client/image_data.js +0 -33
- package/esm/client/image_resizer.d.ts +0 -9
- package/esm/client/image_resizer.d.ts.map +0 -1
- package/esm/client/image_resizer.js +0 -49
- package/esm/client/image_snapshot_options.d.ts +0 -2
- package/esm/client/image_snapshot_options.d.ts.map +0 -1
- package/esm/client/image_snapshot_options.js +0 -6
- package/esm/client/page/augment.d.ts +0 -7
- package/esm/client/page/augment.d.ts.map +0 -1
- package/esm/client/page/augment.js +0 -1
- package/esm/client/page/extend.d.ts +0 -2
- package/esm/client/page/extend.d.ts.map +0 -1
- package/esm/client/page/extend.js +0 -5
- package/esm/client/page/has_image_snapshot.d.ts +0 -10
- package/esm/client/page/has_image_snapshot.d.ts.map +0 -1
- package/esm/client/page/has_image_snapshot.js +0 -15
- package/esm/client/page/to_match_image_snapshot.d.ts +0 -6
- package/esm/client/page/to_match_image_snapshot.d.ts.map +0 -1
- package/esm/client/page/to_match_image_snapshot.js +0 -15
- package/esm/client/selector.d.ts +0 -7
- package/esm/client/selector.d.ts.map +0 -1
- package/esm/client/selector.js +0 -97
- package/esm/client/setup/create_vis.d.ts +0 -96
- package/esm/client/setup/create_vis.d.ts.map +0 -1
- package/esm/client/setup/create_vis.js +0 -109
- package/esm/client/setup/vis.ctx.d.ts +0 -12
- package/esm/client/setup/vis.ctx.d.ts.map +0 -1
- package/esm/client/setup/vis.ctx.js +0 -32
- package/esm/client/setup/vis.d.ts +0 -5
- package/esm/client/setup/vis.d.ts.map +0 -1
- package/esm/client/setup/vis.js +0 -6
- package/esm/client/should_take_snapshot.d.ts +0 -3
- package/esm/client/should_take_snapshot.d.ts.map +0 -1
- package/esm/client/should_take_snapshot.js +0 -3
- package/esm/client/snapshot_meta.d.ts +0 -6
- package/esm/client/snapshot_meta.d.ts.map +0 -1
- package/esm/client/snapshot_meta.js +0 -1
- package/esm/client/task_id.d.ts +0 -7
- package/esm/client/task_id.d.ts.map +0 -1
- package/esm/client/task_id.js +0 -10
- package/esm/client/vitest_browser_context_proxy.d.ts +0 -32
- package/esm/client/vitest_browser_context_proxy.d.ts.map +0 -1
- package/esm/client/vitest_browser_context_proxy.js +0 -11
- package/esm/client/vitest_suite_proxy.d.ts +0 -7
- package/esm/client/vitest_suite_proxy.d.ts.map +0 -1
- package/esm/client/vitest_suite_proxy.js +0 -8
- package/esm/client-api.d.ts +0 -12
- package/esm/client-api.d.ts.map +0 -1
- package/esm/client-api.js +0 -9
- package/esm/commands.d.ts +0 -5
- package/esm/commands.d.ts.map +0 -1
- package/esm/commands.js +0 -4
- package/esm/config/types.d.ts +0 -60
- package/esm/config/types.d.ts.map +0 -1
- package/esm/config/types.js +0 -1
- package/esm/config/vis.d.ts +0 -28
- package/esm/config/vis.d.ts.map +0 -1
- package/esm/config/vis.js +0 -27
- package/esm/config.d.ts +0 -4
- package/esm/config.d.ts.map +0 -1
- package/esm/config.js +0 -2
- package/esm/index.d.ts +0 -5
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -4
- package/esm/presets/auto.d.ts +0 -2
- package/esm/presets/auto.d.ts.map +0 -1
- package/esm/presets/auto.js +0 -8
- package/esm/presets/enable.d.ts +0 -2
- package/esm/presets/enable.d.ts.map +0 -1
- package/esm/presets/enable.js +0 -4
- package/esm/presets/manual.d.ts +0 -2
- package/esm/presets/manual.d.ts.map +0 -1
- package/esm/presets/manual.js +0 -4
- package/esm/server/browser_provider/browser_api.d.ts +0 -3
- package/esm/server/browser_provider/browser_api.d.ts.map +0 -1
- package/esm/server/browser_provider/browser_api.js +0 -11
- package/esm/server/browser_provider/playwright.d.ts +0 -4
- package/esm/server/browser_provider/playwright.d.ts.map +0 -1
- package/esm/server/browser_provider/playwright.js +0 -18
- package/esm/server/browser_provider/types.d.ts +0 -10
- package/esm/server/browser_provider/types.d.ts.map +0 -1
- package/esm/server/browser_provider/types.js +0 -1
- package/esm/server/browser_provider/webdriverio.d.ts +0 -4
- package/esm/server/browser_provider/webdriverio.d.ts.map +0 -1
- package/esm/server/browser_provider/webdriverio.js +0 -12
- package/esm/server/commands/_assertions.d.ts +0 -5
- package/esm/server/commands/_assertions.d.ts.map +0 -1
- package/esm/server/commands/_assertions.js +0 -11
- package/esm/server/commands/augment.d.ts +0 -11
- package/esm/server/commands/augment.d.ts.map +0 -1
- package/esm/server/commands/augment.js +0 -1
- package/esm/server/commands/commands.d.ts +0 -9
- package/esm/server/commands/commands.d.ts.map +0 -1
- package/esm/server/commands/commands.js +0 -14
- package/esm/server/commands/has_image_snapshot.d.ts +0 -6
- package/esm/server/commands/has_image_snapshot.d.ts.map +0 -1
- package/esm/server/commands/has_image_snapshot.js +0 -6
- package/esm/server/commands/image_snapshot_next_index.d.ts +0 -9
- package/esm/server/commands/image_snapshot_next_index.d.ts.map +0 -1
- package/esm/server/commands/image_snapshot_next_index.js +0 -6
- package/esm/server/commands/load_image_snapshot_results.d.ts +0 -21
- package/esm/server/commands/load_image_snapshot_results.d.ts.map +0 -1
- package/esm/server/commands/load_image_snapshot_results.js +0 -6
- package/esm/server/commands/prepare_image_snapshot_comparison.d.ts +0 -38
- package/esm/server/commands/prepare_image_snapshot_comparison.d.ts.map +0 -1
- package/esm/server/commands/prepare_image_snapshot_comparison.js +0 -34
- package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts +0 -35
- package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts.map +0 -1
- package/esm/server/commands/prepare_page_image_snapshot_comparison.js +0 -27
- package/esm/server/commands/setup_vis_suite.d.ts +0 -15
- package/esm/server/commands/setup_vis_suite.d.ts.map +0 -1
- package/esm/server/commands/setup_vis_suite.js +0 -6
- package/esm/server/commands/types.d.ts +0 -3
- package/esm/server/commands/types.d.ts.map +0 -1
- package/esm/server/commands/types.js +0 -1
- package/esm/server/externals/file.d.ts +0 -10
- package/esm/server/externals/file.d.ts.map +0 -1
- package/esm/server/externals/file.js +0 -20
- package/esm/server/project.d.ts +0 -21
- package/esm/server/project.d.ts.map +0 -1
- package/esm/server/project.js +0 -13
- package/esm/server/snapshot.d.ts +0 -6
- package/esm/server/snapshot.d.ts.map +0 -1
- package/esm/server/snapshot.js +0 -29
- package/esm/server/snapshot_path.d.ts +0 -14
- package/esm/server/snapshot_path.d.ts.map +0 -1
- package/esm/server/snapshot_path.js +0 -34
- package/esm/server/snapshot_writer.d.ts +0 -13
- package/esm/server/snapshot_writer.d.ts.map +0 -1
- package/esm/server/snapshot_writer.js +0 -15
- package/esm/server/suite.d.ts +0 -54
- package/esm/server/suite.d.ts.map +0 -1
- package/esm/server/suite.js +0 -73
- package/esm/server/vis_options.d.ts +0 -19
- package/esm/server/vis_options.d.ts.map +0 -1
- package/esm/server/vis_options.js +0 -14
- package/esm/server/vis_server_context.d.ts +0 -50
- package/esm/server/vis_server_context.d.ts.map +0 -1
- package/esm/server/vis_server_context.deps.d.ts +0 -29
- package/esm/server/vis_server_context.deps.d.ts.map +0 -1
- package/esm/server/vis_server_context.deps.js +0 -10
- package/esm/server/vis_server_context.js +0 -2
- package/esm/server/vis_server_context.logic.d.ts +0 -53
- package/esm/server/vis_server_context.logic.d.ts.map +0 -1
- package/esm/server/vis_server_context.logic.js +0 -79
- package/esm/server/vis_server_context.types.d.ts +0 -54
- package/esm/server/vis_server_context.types.d.ts.map +0 -1
- package/esm/server/vis_server_context.types.js +0 -1
- package/esm/server-utils.d.ts +0 -4
- package/esm/server-utils.d.ts.map +0 -1
- package/esm/server-utils.js +0 -3
- package/esm/setup.d.ts +0 -5
- package/esm/setup.d.ts.map +0 -1
- package/esm/setup.js +0 -5
- package/esm/shared/asserts.d.ts +0 -2
- package/esm/shared/asserts.d.ts.map +0 -1
- package/esm/shared/asserts.js +0 -5
- package/esm/shared/base64.d.ts +0 -2
- package/esm/shared/base64.d.ts.map +0 -1
- package/esm/shared/base64.js +0 -3
- package/esm/shared/compare_image.d.ts +0 -6
- package/esm/shared/compare_image.d.ts.map +0 -1
- package/esm/shared/compare_image.js +0 -42
- package/esm/shared/constants.d.ts +0 -6
- package/esm/shared/constants.d.ts.map +0 -1
- package/esm/shared/constants.js +0 -5
- package/esm/shared/convert_threshold_unit.d.ts +0 -6
- package/esm/shared/convert_threshold_unit.d.ts.map +0 -1
- package/esm/shared/convert_threshold_unit.js +0 -10
- package/esm/shared/get_max_size.d.ts +0 -11
- package/esm/shared/get_max_size.d.ts.map +0 -1
- package/esm/shared/get_max_size.js +0 -5
- package/esm/shared/is_same_size.d.ts +0 -8
- package/esm/shared/is_same_size.d.ts.map +0 -1
- package/esm/shared/is_same_size.js +0 -3
- package/esm/shared/trim_common_folder.d.ts +0 -6
- package/esm/shared/trim_common_folder.d.ts.map +0 -1
- package/esm/shared/trim_common_folder.js +0 -11
- package/esm/shared/types.d.ts +0 -90
- package/esm/shared/types.d.ts.map +0 -1
- package/esm/shared/types.js +0 -1
- package/esm/testing/constants.d.ts +0 -9
- package/esm/testing/constants.d.ts.map +0 -1
- package/esm/testing/constants.js +0 -1933
- package/esm/testing/stubBrowserCommandContext.d.ts +0 -8
- package/esm/testing/stubBrowserCommandContext.d.ts.map +0 -1
- package/esm/testing/stubBrowserCommandContext.js +0 -12
- package/esm/testing/stubSuite.d.ts +0 -10
- package/esm/testing/stubSuite.d.ts.map +0 -1
- package/esm/testing/stubSuite.js +0 -27
- package/esm/testing/stubUserConfig.d.ts +0 -7
- package/esm/testing/stubUserConfig.d.ts.map +0 -1
- package/esm/testing/stubUserConfig.js +0 -4
- package/esm/testing.d.ts +0 -3
- package/esm/testing.d.ts.map +0 -1
- package/esm/testing.js +0 -2
- package/src/testing/stubBrowserCommandContext.ts +0 -16
- package/src/testing/stubUserConfig.ts +0 -6
package/esm/server/project.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare function getProjectName(context: {
|
|
2
|
-
project: {
|
|
3
|
-
vite: {
|
|
4
|
-
config: {
|
|
5
|
-
test?: {
|
|
6
|
-
name?: {
|
|
7
|
-
label: string;
|
|
8
|
-
} | string | undefined;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}): string | undefined;
|
|
14
|
-
export declare function getProjectRoot(context: {
|
|
15
|
-
project: {
|
|
16
|
-
config: {
|
|
17
|
-
root: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}): string;
|
|
21
|
-
//# sourceMappingURL=project.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/server/project.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACvC,OAAO,EAAE;QAAE,IAAI,EAAE;YAAE,MAAM,EAAE;gBAAE,IAAI,CAAC,EAAE;oBAAE,IAAI,CAAC,EAAE;wBAAE,KAAK,EAAE,MAAM,CAAA;qBAAE,GAAG,MAAM,GAAG,SAAS,CAAA;iBAAE,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAA;CAC3F,sBASA;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE;QAAE,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,UAEhF"}
|
package/esm/server/project.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function getProjectName(context) {
|
|
2
|
-
const name = context.project.vite.config.test?.name;
|
|
3
|
-
if (typeof name === 'string') {
|
|
4
|
-
return name;
|
|
5
|
-
}
|
|
6
|
-
if (typeof name === 'object' && 'label' in name) {
|
|
7
|
-
return name.label;
|
|
8
|
-
}
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
export function getProjectRoot(context) {
|
|
12
|
-
return context.project.config.root;
|
|
13
|
-
}
|
package/esm/server/snapshot.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommandContext } from 'vitest/node';
|
|
2
|
-
import type { ImageSnapshotTimeoutOptions, PageImageSnapshotOptions } from '../shared/types.ts';
|
|
3
|
-
export declare function takeSnapshot(context: BrowserCommandContext, projectRoot: string, relativeFilePath: string, subject: string, options: ImageSnapshotTimeoutOptions | undefined): Promise<Buffer<ArrayBufferLike>>;
|
|
4
|
-
export declare function takeSnapshotByBrowser(context: BrowserCommandContext, projectRoot: string, relativeFilePath: string, subject: string, options: ImageSnapshotTimeoutOptions | undefined): Promise<Buffer<ArrayBufferLike>>;
|
|
5
|
-
export declare function takePageSnapshot(context: BrowserCommandContext, projectRoot: string, relativeFilePath: string, options: (PageImageSnapshotOptions & ImageSnapshotTimeoutOptions) | undefined): Promise<Buffer<ArrayBufferLike>>;
|
|
6
|
-
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/server/snapshot.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,KAAK,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAI/F,wBAAsB,YAAY,CACjC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,2BAA2B,GAAG,SAAS,oCAOhD;AAED,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,2BAA2B,GAAG,SAAS,oCAQhD;AAED,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,CAAC,wBAAwB,GAAG,2BAA2B,CAAC,GAAG,SAAS,oCAS7E"}
|
package/esm/server/snapshot.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { mkdirp } from 'mkdirp';
|
|
2
|
-
import { dirname, resolve } from 'pathe';
|
|
3
|
-
import { isBase64String } from "../shared/base64.js";
|
|
4
|
-
import { browserApi } from "./browser_provider/browser_api.js";
|
|
5
|
-
import { snapshotWriter } from "./snapshot_writer.js";
|
|
6
|
-
export async function takeSnapshot(context, projectRoot, relativeFilePath, subject, options) {
|
|
7
|
-
if (isBase64String(subject)) {
|
|
8
|
-
await snapshotWriter.writeBase64(resolve(projectRoot, relativeFilePath), subject);
|
|
9
|
-
return Buffer.from(subject, 'base64');
|
|
10
|
-
}
|
|
11
|
-
return takeSnapshotByBrowser(context, projectRoot, relativeFilePath, subject, options);
|
|
12
|
-
}
|
|
13
|
-
export async function takeSnapshotByBrowser(context, projectRoot, relativeFilePath, subject, options) {
|
|
14
|
-
const filePath = resolve(projectRoot, relativeFilePath);
|
|
15
|
-
await mkdirp(dirname(filePath));
|
|
16
|
-
const browser = browserApi(context);
|
|
17
|
-
return browser.takeScreenshot(projectRoot, relativeFilePath, subject ?? 'body', {
|
|
18
|
-
timeout: options?.timeout,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export async function takePageSnapshot(context, projectRoot, relativeFilePath, options) {
|
|
22
|
-
const filePath = resolve(projectRoot, relativeFilePath);
|
|
23
|
-
await mkdirp(dirname(filePath));
|
|
24
|
-
const browser = browserApi(context);
|
|
25
|
-
return browser.takePageScreenshot(projectRoot, relativeFilePath, {
|
|
26
|
-
timeout: options?.timeout,
|
|
27
|
-
fullPage: options?.fullPage,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { VisOptions } from '../config/types.ts';
|
|
2
|
-
import type { PartialBrowserCommandContext } from './vis_server_context.types.ts';
|
|
3
|
-
export declare function resolveSnapshotRootDir(browserCommandContext: PartialBrowserCommandContext, options: VisOptions): string;
|
|
4
|
-
/**
|
|
5
|
-
* Gets the root directory for storing snapshots.
|
|
6
|
-
*
|
|
7
|
-
* @param snapshotRootDir - Base directory for snapshots. Defaults to `__vis__`.
|
|
8
|
-
* @returns The full snapshot root directory path, which includes a platform-specific subdirectory:
|
|
9
|
-
* - When running in CI: `<snapshotRootDir>/<platform>` (e.g. `__vis__/linux`)
|
|
10
|
-
* - When running locally: `<snapshotRootDir>/local`
|
|
11
|
-
*/
|
|
12
|
-
export declare function getSnapshotRootDir(snapshotRootDir?: string): string;
|
|
13
|
-
export declare function getSnapshotSubpath(suiteName: string, options: Pick<VisOptions, 'snapshotSubpath'>): string;
|
|
14
|
-
//# sourceMappingURL=snapshot_path.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_path.d.ts","sourceRoot":"","sources":["../../src/server/snapshot_path.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAGpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAA;AAEjF,wBAAgB,sBAAsB,CAAC,qBAAqB,EAAE,4BAA4B,EAAE,OAAO,EAAE,UAAU,UAY9G;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,eAAe,SAAoB,UAErE;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,UAGjG"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import ci from 'is-ci';
|
|
2
|
-
import { platform } from 'node:process';
|
|
3
|
-
import { SNAPSHOT_ROOT_DIR } from "../shared/constants.js";
|
|
4
|
-
import { trimCommonFolder } from "../shared/trim_common_folder.js";
|
|
5
|
-
export function resolveSnapshotRootDir(browserCommandContext, options) {
|
|
6
|
-
if (!options.snapshotRootDir)
|
|
7
|
-
return getSnapshotRootDir(SNAPSHOT_ROOT_DIR);
|
|
8
|
-
const snapshotRootDir = options.snapshotRootDir;
|
|
9
|
-
if (typeof snapshotRootDir === 'string')
|
|
10
|
-
return getSnapshotRootDir(snapshotRootDir);
|
|
11
|
-
return snapshotRootDir({
|
|
12
|
-
ci,
|
|
13
|
-
browserName: browserCommandContext.provider.browserName,
|
|
14
|
-
providerName: browserCommandContext.provider.name,
|
|
15
|
-
platform,
|
|
16
|
-
screenshotFailures: browserCommandContext.provider.options?.screenshotFailures,
|
|
17
|
-
screenshotDirectory: browserCommandContext.provider.options?.screenshotDirectory,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Gets the root directory for storing snapshots.
|
|
22
|
-
*
|
|
23
|
-
* @param snapshotRootDir - Base directory for snapshots. Defaults to `__vis__`.
|
|
24
|
-
* @returns The full snapshot root directory path, which includes a platform-specific subdirectory:
|
|
25
|
-
* - When running in CI: `<snapshotRootDir>/<platform>` (e.g. `__vis__/linux`)
|
|
26
|
-
* - When running locally: `<snapshotRootDir>/local`
|
|
27
|
-
*/
|
|
28
|
-
export function getSnapshotRootDir(snapshotRootDir = SNAPSHOT_ROOT_DIR) {
|
|
29
|
-
return `${snapshotRootDir}/${ci ? platform : 'local'}`;
|
|
30
|
-
}
|
|
31
|
-
export function getSnapshotSubpath(suiteName, options) {
|
|
32
|
-
const snapshotSubpath = options.snapshotSubpath ?? (({ subpath }) => trimCommonFolder(subpath));
|
|
33
|
-
return snapshotSubpath({ subpath: suiteName });
|
|
34
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface SnapshotWriter {
|
|
2
|
-
writeBase64(filePath: string, data: string): Promise<void>;
|
|
3
|
-
writeBuffer(filePath: string, data: Buffer): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
export declare function createSnapshotWriter({ mkdirp, writeFile }?: {
|
|
6
|
-
existFile(filePath: string): Promise<boolean>;
|
|
7
|
-
glob(pattern: string | string[], options?: import("glob").GlobOptionsWithFileTypesUnset | undefined): Promise<string[]>;
|
|
8
|
-
mkdirp: (path: string) => Promise<string | undefined>;
|
|
9
|
-
tryReadFile(filePath: string | undefined): Promise<Buffer | undefined>;
|
|
10
|
-
writeFile: typeof import("fs/promises").writeFile;
|
|
11
|
-
}): SnapshotWriter;
|
|
12
|
-
export declare const snapshotWriter: SnapshotWriter;
|
|
13
|
-
//# sourceMappingURL=snapshot_writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_writer.d.ts","sourceRoot":"","sources":["../../src/server/snapshot_writer.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC9B,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1D,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1D;AAED,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE;;;;;;CAAO,GAAG,cAAc,CAWjF;AAED,eAAO,MAAM,cAAc,gBAAyB,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { dirname } from 'pathe';
|
|
2
|
-
import { file } from "./externals/file.js";
|
|
3
|
-
export function createSnapshotWriter({ mkdirp, writeFile } = file) {
|
|
4
|
-
return {
|
|
5
|
-
async writeBase64(filePath, data) {
|
|
6
|
-
await mkdirp(dirname(filePath));
|
|
7
|
-
await writeFile(filePath, data, { encoding: 'base64' });
|
|
8
|
-
},
|
|
9
|
-
async writeBuffer(filePath, data) {
|
|
10
|
-
await mkdirp(dirname(filePath));
|
|
11
|
-
await writeFile(filePath, data);
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export const snapshotWriter = createSnapshotWriter();
|
package/esm/server/suite.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { UserConfig } from 'vitest/node';
|
|
2
|
-
import type { VisOptions } from '../config/types.ts';
|
|
3
|
-
import type { PartialBrowserCommandContext, VisSuite } from './vis_server_context.types.ts';
|
|
4
|
-
/**
|
|
5
|
-
* Setup suite is called on each test file's beforeAll hook.
|
|
6
|
-
* Test files include vitest test files and storybook story files.
|
|
7
|
-
* It needs to make sure there is no race condition between the test files.
|
|
8
|
-
*/
|
|
9
|
-
export declare function setupSuite(browserContext: PartialBrowserCommandContext): Promise<{
|
|
10
|
-
comparisonMethod: any;
|
|
11
|
-
diffOptions: Partial<import("ssim.js/dist/types.js").Options> | {
|
|
12
|
-
threshold?: number | undefined;
|
|
13
|
-
includeAA?: boolean | undefined;
|
|
14
|
-
alpha?: number | undefined;
|
|
15
|
-
aaColor?: [number, number, number] | undefined;
|
|
16
|
-
diffColor?: [number, number, number] | undefined;
|
|
17
|
-
diffColorAlt?: [number, number, number] | undefined;
|
|
18
|
-
diffMask?: boolean | undefined;
|
|
19
|
-
} | undefined;
|
|
20
|
-
failureThreshold: number | undefined;
|
|
21
|
-
failureThresholdType: "pixel" | "percent" | undefined;
|
|
22
|
-
snapshotKey: string | undefined;
|
|
23
|
-
subject: string | undefined;
|
|
24
|
-
timeout: number | undefined;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Suite ID also contains the project name to make it unique
|
|
28
|
-
* across different projects.
|
|
29
|
-
*/
|
|
30
|
-
export declare function getSuiteId(context: {
|
|
31
|
-
project: {
|
|
32
|
-
config: {
|
|
33
|
-
root: string;
|
|
34
|
-
name: string;
|
|
35
|
-
};
|
|
36
|
-
vite: {
|
|
37
|
-
config: {
|
|
38
|
-
test?: {
|
|
39
|
-
name?: UserConfig['name'] | undefined;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}): string;
|
|
45
|
-
export declare function createModule(state: VisSuite, testPath: string, options: Pick<VisOptions, 'snapshotSubpath'>): {
|
|
46
|
-
taskSubpath: string;
|
|
47
|
-
baselineDir: string;
|
|
48
|
-
resultDir: string;
|
|
49
|
-
diffDir: string;
|
|
50
|
-
tasks: {};
|
|
51
|
-
};
|
|
52
|
-
export declare function getTaskSubpath(state: VisSuite, testPath: string, options: Pick<VisOptions, 'snapshotSubpath'>): string;
|
|
53
|
-
export declare function getSuite(context: PartialBrowserCommandContext): Promise<VisSuite>;
|
|
54
|
-
//# sourceMappingURL=suite.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../src/server/suite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAMpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,QAAQ,EAAa,MAAM,+BAA+B,CAAA;AAItG;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,cAAc,EAAE,4BAA4B;;;;;;;;;;;;;;;;GA2B5E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE;IACnC,OAAO,EAAE;QACR,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;QACtC,IAAI,EAAE;YAAE,MAAM,EAAE;gBAAE,IAAI,CAAC,EAAE;oBAAE,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;iBAAE,CAAA;aAAE,CAAA;SAAE,CAAA;KACtE,CAAA;CACD,UAEA;AAyBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC;;;;;;EAS3G;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,UAE7G;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,4BAA4B,qBAE7D"}
|
package/esm/server/suite.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { join, relative } from 'pathe';
|
|
2
|
-
import { BASELINE_DIR, DIFF_DIR, RESULT_DIR } from "../shared/constants.js";
|
|
3
|
-
import { getProjectName, getProjectRoot } from "./project.js";
|
|
4
|
-
import { getSnapshotSubpath, resolveSnapshotRootDir } from "./snapshot_path.js";
|
|
5
|
-
import { getVisOption } from "./vis_options.js";
|
|
6
|
-
import { deps } from "./vis_server_context.deps.js";
|
|
7
|
-
const suites = {};
|
|
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
|
-
export async function setupSuite(browserContext) {
|
|
14
|
-
const suiteId = getSuiteId(browserContext);
|
|
15
|
-
const visOptions = getVisOption(browserContext);
|
|
16
|
-
if (!suites[suiteId]) {
|
|
17
|
-
suites[suiteId] = createSuite(browserContext, visOptions);
|
|
18
|
-
}
|
|
19
|
-
const suite = await suites[suiteId];
|
|
20
|
-
const { taskSubpath, baselineDir, diffDir, resultDir, tasks } = createModule(suite, browserContext.testPath, visOptions);
|
|
21
|
-
suite.modules[taskSubpath] = { baselineDir, diffDir, resultDir, tasks };
|
|
22
|
-
await Promise.allSettled([deps.rimraf(diffDir), deps.rimraf(resultDir)]);
|
|
23
|
-
return {
|
|
24
|
-
comparisonMethod: visOptions.comparisonMethod,
|
|
25
|
-
diffOptions: visOptions.diffOptions,
|
|
26
|
-
failureThreshold: visOptions.failureThreshold,
|
|
27
|
-
failureThresholdType: visOptions.failureThresholdType,
|
|
28
|
-
snapshotKey: visOptions.snapshotKey,
|
|
29
|
-
subject: visOptions.subject,
|
|
30
|
-
timeout: visOptions.timeout,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Suite ID also contains the project name to make it unique
|
|
35
|
-
* across different projects.
|
|
36
|
-
*/
|
|
37
|
-
export function getSuiteId(context) {
|
|
38
|
-
return `${getProjectName(context)}/${context.project.config.name}`;
|
|
39
|
-
}
|
|
40
|
-
async function createSuite(browserContext, visOptions) {
|
|
41
|
-
const snapshotRootDir = resolveSnapshotRootDir(browserContext, visOptions);
|
|
42
|
-
const projectRoot = getProjectRoot(browserContext);
|
|
43
|
-
const state = {
|
|
44
|
-
projectRoot,
|
|
45
|
-
testTimeout: browserContext.project.config.testTimeout,
|
|
46
|
-
hookTimeout: browserContext.project.config.hookTimeout,
|
|
47
|
-
snapshotRootDir,
|
|
48
|
-
snapshotBaselineDir: join(snapshotRootDir, BASELINE_DIR),
|
|
49
|
-
snapshotResultDir: join(snapshotRootDir, RESULT_DIR),
|
|
50
|
-
snapshotDiffDir: join(snapshotRootDir, DIFF_DIR),
|
|
51
|
-
snapshotRootPath: join(projectRoot, snapshotRootDir),
|
|
52
|
-
subject: visOptions.subject,
|
|
53
|
-
modules: {},
|
|
54
|
-
};
|
|
55
|
-
await Promise.allSettled([deps.rimraf(join(state.snapshotDiffDir)), deps.rimraf(join(state.snapshotResultDir))]);
|
|
56
|
-
return state;
|
|
57
|
-
}
|
|
58
|
-
export function createModule(state, testPath, options) {
|
|
59
|
-
const taskSubpath = getTaskSubpath(state, testPath, options);
|
|
60
|
-
return {
|
|
61
|
-
taskSubpath,
|
|
62
|
-
baselineDir: join(state.snapshotBaselineDir, taskSubpath),
|
|
63
|
-
resultDir: join(state.snapshotResultDir, taskSubpath),
|
|
64
|
-
diffDir: join(state.snapshotDiffDir, taskSubpath),
|
|
65
|
-
tasks: {},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export function getTaskSubpath(state, testPath, options) {
|
|
69
|
-
return getSnapshotSubpath(relative(state.projectRoot, testPath), options);
|
|
70
|
-
}
|
|
71
|
-
export function getSuite(context) {
|
|
72
|
-
return suites[getSuiteId(context)];
|
|
73
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { UserConfig } from 'vitest/node';
|
|
2
|
-
import type { VisOptions } from '../config/types.ts';
|
|
3
|
-
export declare function setVisOption(userConfig: {
|
|
4
|
-
test?: {
|
|
5
|
-
name?: UserConfig['name'] | undefined;
|
|
6
|
-
} | undefined;
|
|
7
|
-
}, options: VisOptions<any> | undefined): void;
|
|
8
|
-
export declare function getVisOption(context: {
|
|
9
|
-
project: {
|
|
10
|
-
vite: {
|
|
11
|
-
config: {
|
|
12
|
-
test?: {
|
|
13
|
-
name?: UserConfig['name'];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
}): VisOptions<any>;
|
|
19
|
-
//# sourceMappingURL=vis_options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vis_options.d.ts","sourceRoot":"","sources":["../../src/server/vis_options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAQpD,wBAAgB,YAAY,CAC3B,UAAU,EAAE;IAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;KAAE,GAAG,SAAS,CAAA;CAAE,EAC5E,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,QAQpC;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE;YAAE,MAAM,EAAE;gBAAE,IAAI,CAAC,EAAE;oBAAE,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;iBAAE,CAAA;aAAE,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,mBAIhH"}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 = typeof name === 'string' ? name : typeof name === 'object' ? name?.label : 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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,29 +0,0 @@
|
|
|
1
|
-
export declare const deps: {
|
|
2
|
-
rimraf: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
3
|
-
rimraf: (path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>;
|
|
4
|
-
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
5
|
-
rimrafSync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
6
|
-
manual: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
7
|
-
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
8
|
-
};
|
|
9
|
-
manualSync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
10
|
-
native: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
11
|
-
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
12
|
-
};
|
|
13
|
-
nativeSync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
14
|
-
posix: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
15
|
-
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
16
|
-
};
|
|
17
|
-
posixSync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
18
|
-
windows: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
19
|
-
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
20
|
-
};
|
|
21
|
-
windowsSync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
22
|
-
moveRemove: ((path: string | string[], opt?: import("rimraf").RimrafAsyncOptions) => Promise<boolean>) & {
|
|
23
|
-
sync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
24
|
-
};
|
|
25
|
-
moveRemoveSync: (path: string | string[], opt?: import("rimraf").RimrafSyncOptions) => boolean;
|
|
26
|
-
};
|
|
27
|
-
getSnapshotPlatform(): NodeJS.Platform | "local";
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=vis_server_context.deps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,53 +0,0 @@
|
|
|
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<{
|
|
7
|
-
baselinePath: string;
|
|
8
|
-
resultPath: string;
|
|
9
|
-
diffPath: string;
|
|
10
|
-
comparisonMethod: any;
|
|
11
|
-
diffOptions?: Partial<import("ssim.js/dist/types.js").Options> | undefined;
|
|
12
|
-
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
|
|
13
|
-
failureThreshold?: number | undefined | undefined;
|
|
14
|
-
timeout?: number | undefined | undefined;
|
|
15
|
-
} | {
|
|
16
|
-
baselinePath: string;
|
|
17
|
-
resultPath: string;
|
|
18
|
-
diffPath: string;
|
|
19
|
-
comparisonMethod?: any;
|
|
20
|
-
diffOptions?: {
|
|
21
|
-
threshold?: number | undefined;
|
|
22
|
-
includeAA?: boolean | undefined;
|
|
23
|
-
alpha?: number | undefined;
|
|
24
|
-
aaColor?: [number, number, number] | undefined;
|
|
25
|
-
diffColor?: [number, number, number] | undefined;
|
|
26
|
-
diffColorAlt?: [number, number, number] | undefined;
|
|
27
|
-
diffMask?: boolean | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
failureThresholdType?: "pixel" | "percent" | undefined | undefined;
|
|
30
|
-
failureThreshold?: number | undefined | undefined;
|
|
31
|
-
timeout?: number | undefined | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
getTaskCount(browserContext: PartialBrowserCommandContext, taskId: string): Promise<number>;
|
|
34
|
-
hasImageSnapshot(browserContext: PartialBrowserCommandContext, taskId: string, snapshotKey: string | undefined): Promise<boolean>;
|
|
35
|
-
getSnapshotFilename(browserContext: PartialBrowserCommandContext, info: {
|
|
36
|
-
taskId: string;
|
|
37
|
-
task: {
|
|
38
|
-
count: number;
|
|
39
|
-
};
|
|
40
|
-
}, snapshotKey: string | undefined): string;
|
|
41
|
-
getSuiteInfo(browserContext: PartialBrowserCommandContext, taskId: string): Promise<{
|
|
42
|
-
projectRoot: string;
|
|
43
|
-
suiteId: string;
|
|
44
|
-
taskId: string;
|
|
45
|
-
baselineDir: string;
|
|
46
|
-
resultDir: string;
|
|
47
|
-
diffDir: string;
|
|
48
|
-
task: {
|
|
49
|
-
count: number;
|
|
50
|
-
};
|
|
51
|
-
}>;
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=vis_server_context.logic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,79 +0,0 @@
|
|
|
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,54 +0,0 @@
|
|
|
1
|
-
import type { UserConfig } from 'vitest/node';
|
|
2
|
-
export type VisSuites = {
|
|
3
|
-
[projectPath: string]: Promise<VisSuite>;
|
|
4
|
-
};
|
|
5
|
-
export type VisSuite = {
|
|
6
|
-
projectRoot: string;
|
|
7
|
-
testTimeout: number;
|
|
8
|
-
hookTimeout: number;
|
|
9
|
-
snapshotRootDir: string;
|
|
10
|
-
snapshotBaselineDir: string;
|
|
11
|
-
snapshotResultDir: string;
|
|
12
|
-
snapshotDiffDir: string;
|
|
13
|
-
snapshotRootPath: string;
|
|
14
|
-
subject: string | undefined;
|
|
15
|
-
modules: Record<string, {
|
|
16
|
-
baselineDir: string;
|
|
17
|
-
resultDir: string;
|
|
18
|
-
diffDir: string;
|
|
19
|
-
tasks: Record<string, {
|
|
20
|
-
count: number;
|
|
21
|
-
}>;
|
|
22
|
-
}>;
|
|
23
|
-
};
|
|
24
|
-
export type PartialBrowserCommandContext = {
|
|
25
|
-
project: {
|
|
26
|
-
config: {
|
|
27
|
-
name: string;
|
|
28
|
-
root: string;
|
|
29
|
-
snapshotOptions: {
|
|
30
|
-
updateSnapshot: 'all' | 'new' | 'none';
|
|
31
|
-
};
|
|
32
|
-
testTimeout: number;
|
|
33
|
-
hookTimeout: number;
|
|
34
|
-
};
|
|
35
|
-
vite: {
|
|
36
|
-
config: {
|
|
37
|
-
test?: {
|
|
38
|
-
name?: UserConfig['name'] | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
provider: {
|
|
44
|
-
name: string;
|
|
45
|
-
browserName?: string | undefined;
|
|
46
|
-
options?: {
|
|
47
|
-
headless?: boolean | undefined;
|
|
48
|
-
screenshotFailures?: boolean | undefined;
|
|
49
|
-
screenshotDirectory?: string | undefined;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
testPath: string;
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=vis_server_context.types.d.ts.map
|