vitest-plugin-vis 3.5.1 → 4.1.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-C1tjdh5B.d.mts +33 -0
- package/dist/augment-C1tjdh5B.d.mts.map +1 -0
- package/dist/auto_snapshot_matcher-C0y6mAeS.mjs +381 -0
- package/dist/auto_snapshot_matcher-C0y6mAeS.mjs.map +1 -0
- package/dist/auto_snapshot_options-BMRtKmod.d.mts +45 -0
- package/dist/auto_snapshot_options-BMRtKmod.d.mts.map +1 -0
- package/dist/auto_snapshot_options-DUOTpF2N.mjs +88 -0
- package/dist/auto_snapshot_options-DUOTpF2N.mjs.map +1 -0
- package/dist/base64-CHSENEAO.mjs +8 -0
- package/dist/base64-CHSENEAO.mjs.map +1 -0
- package/dist/client-api.d.mts +44 -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/commands.types-BVhcnnHw.d.mts +51 -0
- package/dist/commands.types-BVhcnnHw.d.mts.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-DCytWz48.mjs +124 -0
- package/dist/setup-DCytWz48.mjs.map +1 -0
- package/dist/setup.d.mts +106 -0
- package/dist/setup.d.mts.map +1 -0
- package/dist/setup.mjs +8 -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/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--tTmHoRA.d.mts +9 -0
- package/dist/to_match_image_snapshot.types--tTmHoRA.d.mts.map +1 -0
- package/dist/trim_common_folder-DBThLerp.d.mts +9 -0
- package/dist/trim_common_folder-DBThLerp.d.mts.map +1 -0
- package/dist/types-CEmjj-A9.d.mts +144 -0
- package/dist/types-CEmjj-A9.d.mts.map +1 -0
- package/dist/types-DJYCbyT8.d.mts +63 -0
- package/dist/types-DJYCbyT8.d.mts.map +1 -0
- package/package.json +55 -39
- package/readme.md +58 -6
- package/src/client/actions/has_image_snapshot_action.ts +1 -1
- package/src/client/actions/load_image_snapshot_results_action.ts +1 -1
- package/src/client/actions/match_image_snapshot_action.ts +7 -5
- package/src/client/actions/match_page_image_snapshot_action.ts +6 -4
- package/src/client/expect/_ctx.ts +10 -0
- package/src/client/expect/to_match_image_snapshot.ts +3 -4
- package/src/client/external/browser/has_render_content.ts +3 -0
- package/src/client/{image_resizer.ts → external/browser/image_resizer.ts} +1 -1
- package/src/client/{vitest_browser_context_proxy.ts → external/vitest/vitest_browser_context_proxy.ts} +3 -3
- package/src/client/{vitest_suite_proxy.ts → external/vitest/vitest_suite_proxy.ts} +1 -1
- package/src/client/{align_images.ts → image/align_images.ts} +3 -3
- package/src/client/page/_ctx.ts +12 -0
- 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 +4 -4
- package/src/client/page/to_match_image_snapshot.mdx +1 -1
- package/src/client/page/to_match_image_snapshot.ts +3 -4
- package/src/client/{compare_image_snapshot.logic.ts → snapshot/compare_image_snapshot.logic.ts} +1 -1
- package/src/client/{compare_image_snapshot.ts → snapshot/compare_image_snapshot.ts} +8 -9
- package/src/client/snapshot/should_take_snapshot.ts +6 -0
- package/src/client/suite/_ctx.ts +8 -0
- package/src/client/suite/auto_snapshot_matcher.ts +68 -0
- package/src/client/{ctx.ts → task/_ctx.ts} +1 -3
- package/src/client/{auto_snapshot_options.ts → task/auto_snapshot_options.ts} +20 -5
- package/src/client/{snapshot_meta.ts → task/snapshot_meta.ts} +6 -1
- package/src/client-api.ts +3 -2
- package/src/config/vis.ts +4 -4
- package/src/index.ts +1 -1
- 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 +9 -7
- package/src/server/commands/has_image_snapshot.ts +3 -6
- package/src/server/commands/image_snapshot_next_index.ts +3 -9
- package/src/server/commands/load_image_snapshot_results.ts +3 -23
- package/src/server/commands/prepare_image_snapshot_comparison.ts +4 -50
- package/src/server/commands/prepare_page_image_snapshot_comparison.ts +3 -45
- package/src/server/commands/setup_vis_suite.ts +3 -27
- 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 +8 -8
- package/src/server/vis_server_context.types.ts +31 -26
- package/src/{client/setup → setup}/create_vis.ts +23 -78
- package/src/setup/readme.md +5 -0
- package/src/{client/setup → setup}/vis.ts +1 -1
- package/src/setup.ts +2 -2
- package/src/shared/commands.types.ts +71 -0
- package/src/shared/types.ts +55 -1
- 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/client/image_snapshot_options.ts +0 -6
- package/src/client/setup/vis.ctx.ts +0 -33
- package/src/client/should_take_snapshot.ts +0 -5
- package/src/server/commands/types.ts +0 -9
- package/src/testing/stubBrowserCommandContext.ts +0 -16
- package/src/testing/stubUserConfig.ts +0 -6
- /package/src/client/{image_data.ts → external/browser/image_data.ts} +0 -0
- /package/src/client/{selector.ts → external/browser/selector.ts} +0 -0
- /package/src/client/{auto_snapshot_options.mdx → task/auto_snapshot_options.mdx} +0 -0
- /package/src/client/{task_id.ts → task/task_id.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { _ as ToMatchImageSnapshotOptions, n as ComparisonMethod } from "./types-CEmjj-A9.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/client/expect/to_match_image_snapshot.types.d.ts
|
|
4
|
+
interface ImageSnapshotMatcher {
|
|
5
|
+
toMatchImageSnapshot<M extends ComparisonMethod>(options?: ToMatchImageSnapshotOptions<M> | undefined): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ImageSnapshotMatcher as t };
|
|
9
|
+
//# sourceMappingURL=to_match_image_snapshot.types--tTmHoRA.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to_match_image_snapshot.types--tTmHoRA.d.mts","names":[],"sources":["../src/client/expect/to_match_image_snapshot.types.ts"],"sourcesContent":[],"mappings":";;;UAEiB,oBAAA;iCACe,4BAA4B,4BAA4B,iBAAiB;AADzG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/shared/trim_common_folder.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Trim off common folder such as `src` or `tests` from the test file path.
|
|
4
|
+
* This is used to generate the default snapshot sub-path.
|
|
5
|
+
*/
|
|
6
|
+
declare function trimCommonFolder(suiteName: string): string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { trimCommonFolder as t };
|
|
9
|
+
//# sourceMappingURL=trim_common_folder-DBThLerp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trim_common_folder-DBThLerp.d.mts","names":[],"sources":["../src/shared/trim_common_folder.ts"],"sourcesContent":[],"mappings":";;AAIA;;;iBAAgB,gBAAA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import pixelMatch from "pixelmatch";
|
|
2
|
+
import { Options as SsimDiffOptions } from "ssim.js";
|
|
3
|
+
|
|
4
|
+
//#region src/client/task/snapshot_meta.d.ts
|
|
5
|
+
type SnapshotMeta<M extends ComparisonMethod> = ToMatchImageSnapshotOptions<M> & ImageSnapshotSubjectOptions & {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to enable the snapshot.
|
|
8
|
+
*
|
|
9
|
+
* Default: `true`
|
|
10
|
+
*/
|
|
11
|
+
enable?: boolean | undefined;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/shared/constants.d.ts
|
|
16
|
+
declare const NAME = "vis";
|
|
17
|
+
declare const SNAPSHOT_ROOT_DIR = "__vis__";
|
|
18
|
+
declare const BASELINE_DIR = "__baselines__";
|
|
19
|
+
declare const RESULT_DIR = "__results__";
|
|
20
|
+
declare const DIFF_DIR = "__diffs__";
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/shared/types.d.ts
|
|
23
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
24
|
+
interface ImageSnapshotTimeoutOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Timeout for taking the snapshot.
|
|
27
|
+
*
|
|
28
|
+
* Default: 30000 ms (30 seconds)
|
|
29
|
+
*/
|
|
30
|
+
timeout?: number | undefined;
|
|
31
|
+
}
|
|
32
|
+
interface ImageSnapshotKeyOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Customize the `snapshotKey` of the snapshot.
|
|
35
|
+
*/
|
|
36
|
+
snapshotKey?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
type ComparisonMethod = 'pixel' | 'ssim';
|
|
39
|
+
type FailureThresholdOptions = {
|
|
40
|
+
/**
|
|
41
|
+
* Failure threshold should measure in `pixel` or `percent`.
|
|
42
|
+
*
|
|
43
|
+
* Default is `pixel`.
|
|
44
|
+
*/
|
|
45
|
+
failureThresholdType?: 'pixel' | 'percent' | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Failure tolerance threshold.
|
|
48
|
+
*
|
|
49
|
+
* If `failureThresholdType` is `pixel`, the value is the number of pixels that are allowed to be different.
|
|
50
|
+
* If `failureThresholdType` is `percent`, the value is the percentage of pixels that are allowed to be different.
|
|
51
|
+
*
|
|
52
|
+
* Default is `0`.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* // Allow 10 pixels to be different
|
|
57
|
+
* failureThresholdType: 'pixel'
|
|
58
|
+
* failureThreshold: 10
|
|
59
|
+
*
|
|
60
|
+
* // Allow 10% of pixels to be different
|
|
61
|
+
* failureThresholdType: 'percent'
|
|
62
|
+
* failureThreshold: 10
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
failureThreshold?: number | undefined;
|
|
66
|
+
};
|
|
67
|
+
type SsimComparisonOptions<M = 'ssim'> = {
|
|
68
|
+
comparisonMethod: M;
|
|
69
|
+
/**
|
|
70
|
+
* Custom options passed to 'ssim'
|
|
71
|
+
*/
|
|
72
|
+
diffOptions?: Partial<SsimDiffOptions> | undefined;
|
|
73
|
+
};
|
|
74
|
+
type PixelComparisonOptions<M = 'pixel'> = {
|
|
75
|
+
comparisonMethod?: M | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Custom options passed to 'pixelmatch'
|
|
78
|
+
*/
|
|
79
|
+
diffOptions?: PixelDiffOptions | undefined;
|
|
80
|
+
};
|
|
81
|
+
type PixelDiffOptions = Parameters<typeof pixelMatch>[5];
|
|
82
|
+
type ImageSnapshotCompareOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim' ? SsimComparisonOptions<M> : PixelComparisonOptions<M>) & FailureThresholdOptions;
|
|
83
|
+
type ImageSnapshotSubjectOptions = {
|
|
84
|
+
/**
|
|
85
|
+
* Specify the query of the subject element.
|
|
86
|
+
*
|
|
87
|
+
* If the test does not have an element with the specified query,
|
|
88
|
+
* the `body` element will be used.
|
|
89
|
+
*/
|
|
90
|
+
subject?: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
type ToMatchImageSnapshotOptions<M extends ComparisonMethod = 'pixel'> = ImageSnapshotTimeoutOptions & ImageSnapshotKeyOptions & ImageSnapshotCompareOptions<M> & {
|
|
93
|
+
/**
|
|
94
|
+
* Expect the matcher to fail.
|
|
95
|
+
* If it passes, it will throw an error with details.
|
|
96
|
+
*/
|
|
97
|
+
expectToFail?: boolean | undefined;
|
|
98
|
+
};
|
|
99
|
+
interface PageImageSnapshotOptions {
|
|
100
|
+
fullPage?: boolean | undefined;
|
|
101
|
+
}
|
|
102
|
+
type ToMatchPageImageSnapshotOptions<M extends ComparisonMethod = 'pixel'> = ToMatchImageSnapshotOptions<M> & PageImageSnapshotOptions;
|
|
103
|
+
type SnapshotTestMeta = {
|
|
104
|
+
meta: {
|
|
105
|
+
[NAME]?: SnapshotMeta<ComparisonMethod>;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
type ImageSnapshotComparisonInfo = {
|
|
109
|
+
/**
|
|
110
|
+
* Path to the project root.
|
|
111
|
+
*/
|
|
112
|
+
projectRoot: string;
|
|
113
|
+
/**
|
|
114
|
+
* Path to the baseline image relative to the project root.
|
|
115
|
+
*/
|
|
116
|
+
baselinePath: string;
|
|
117
|
+
/**
|
|
118
|
+
* Path to the result image relative to the project root.
|
|
119
|
+
*/
|
|
120
|
+
resultPath: string;
|
|
121
|
+
/**
|
|
122
|
+
* Path to the diff image relative to the project root.
|
|
123
|
+
*/
|
|
124
|
+
diffPath: string;
|
|
125
|
+
/**
|
|
126
|
+
* Base64 encoded baseline image.
|
|
127
|
+
*/
|
|
128
|
+
baseline: string;
|
|
129
|
+
/**
|
|
130
|
+
* Base64 encoded result image.
|
|
131
|
+
*/
|
|
132
|
+
result: string;
|
|
133
|
+
/**
|
|
134
|
+
* Base64 encoded diff image.
|
|
135
|
+
*/
|
|
136
|
+
diff?: string | undefined;
|
|
137
|
+
} & ImageSnapshotTimeoutOptions & FailureThresholdOptions & (SsimComparisonOptions | PixelComparisonOptions);
|
|
138
|
+
type MatchImageSnapshotOptions = ImageSnapshotTimeoutOptions & ImageSnapshotCompareOptions<any> & ImageSnapshotKeyOptions;
|
|
139
|
+
type SetupVisOptions<GM extends Record<string, any> | unknown = unknown> = {
|
|
140
|
+
auto?: boolean | (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void) | Record<string, boolean | (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)>;
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
export { SNAPSHOT_ROOT_DIR as C, RESULT_DIR as S, ToMatchImageSnapshotOptions as _, ImageSnapshotComparisonInfo as a, DIFF_DIR as b, ImageSnapshotTimeoutOptions as c, PixelComparisonOptions as d, PixelDiffOptions as f, SsimDiffOptions as g, SsimComparisonOptions as h, ImageSnapshotCompareOptions as i, MatchImageSnapshotOptions as l, SnapshotTestMeta as m, ComparisonMethod as n, ImageSnapshotKeyOptions as o, SetupVisOptions as p, FailureThresholdOptions as r, ImageSnapshotSubjectOptions as s, Awaitable as t, PageImageSnapshotOptions as u, ToMatchPageImageSnapshotOptions as v, SnapshotMeta as w, NAME as x, BASELINE_DIR as y };
|
|
144
|
+
//# sourceMappingURL=types-CEmjj-A9.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CEmjj-A9.d.mts","names":[],"sources":["../src/client/task/snapshot_meta.ts","../src/shared/constants.ts","../src/shared/types.ts"],"sourcesContent":[],"mappings":";;;;KAEY,uBAAuB,oBAAoB,4BAA4B,KAClF;;;AADD;;;EAAuD,MAAA,CAAA,EAAA,OAAA,GAAA,SAAA;EACtD,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;CAA2B;;;cCHf,IAAA;cACA,iBAAA;cACA,YAAA;cACA,UAAA;ADDD,cCEC,QAAA,GDFW,WAAA;;;AAAZ,KEGA,SFHY,CAAA,CAAA,CAAA,GEGG,CFHH,GEGO,WFHP,CEGmB,CFHnB,CAAA;AAAW,UEKlB,2BAAA,CFLkB;EAAgD;;;;;;;ACFtE,UCgBI,uBAAA,CDhBA;EACJ;AACb;AACA;EACa,WAAQ,CAAA,EAAA,MAAA,GAAA,SAAA;;KCmBT,gBAAA;KAEA,uBAAA;EApBA;;;;;EAEK,oBAAA,CAAA,EAAA,OAA2B,GAAA,SAAA,GAAA,SAAA;EAS3B;AAOjB;AAEA;AA6BA;;;;;AAUA;AAQA;AAEA;;;;;;;;;EAKY,gBAAA,CAAA,EAAA,MAAA,GAAA,SAA2B;AASvC,CAAA;AAAkD,KAlCtC,qBAkCsC,CAAA,IAAA,MAAA,CAAA,GAAA;EAA8B,gBAAA,EAjC7D,CAiC6D;EAC/E;;;EAC2B,WAAA,CAAA,EA/Bb,OA+Ba,CA/BL,eA+BK,CAAA,GAAA,SAAA;AAQ5B,CAAA;AAIsD,KAtC1C,sBAsC0C,CAAA,IAAA,OAAA,CAAA,GAAA;EAA0D,gBAAA,CAAA,EArC5F,CAqC4F,GAAA,SAAA;EAA5B;;;EAGxE,WAAA,CAAA,EApCG,gBAoCa,GAAA,SAAA;CAEJ;AAAb,KAnCC,gBAAA,GAAmB,UAmCpB,CAAA,OAnCsC,UAmCtC,CAAA,CAAA,CAAA,CAAA;AAAR,KAjCS,2BAiCT,CAAA,UAjC+C,gBAiC/C,GAAA,OAAA,CAAA,GAAA,CAjC8E,CAiC9E,SAAA,MAAA,GAhCA,qBAgCA,CAhCsB,CAgCtB,CAAA,GA/BA,sBA+BA,CA/BuB,CA+BvB,CAAA,CAAA,GA9BF,uBA8BE;AAAI,KA5BK,2BAAA,GA4BL;EAIK;;;;;;EAiCA,OAAA,CAAA,EAAA,MAAA,GAAA,SAAyB;CAAG;AACvC,KAzDW,2BAyDX,CAAA,UAzDiD,gBAyDjD,GAAA,OAAA,CAAA,GAzD+E,2BAyD/E,GAxDA,uBAwDA,GAvDA,2BAuDA,CAvD4B,CAuD5B,CAAA,GAAA;EACA;;AAED;;EAGgB,YAAA,CAAA,EAAA,OAAA,GAAA,SAAA;CAA4B;AAClB,UAtDT,wBAAA,CAsDS;EAAb,QAAA,CAAA,EAAA,OAAA,GAAA,SAAA;;AAAsB,KAlDvB,+BAkDuB,CAAA,UAlDmB,gBAkDnB,GAAA,OAAA,CAAA,GAlDiD,2BAkDjD,CAlD6E,CAkD7E,CAAA,GAjDlC,wBAiDkC;AAC1B,KAhDG,gBAAA,GAgDH;EAAmB,IAAA,EAAA;IAIV,CAlDf,IAAA,EAkDe,EAlDP,YAkDO,CAlDM,gBAkDN,CAAA;EAA4B,CAAA;CAClB;AAAb,KA/CH,2BAAA,GA+CG;EAAkB;;;EACH,WAAA,EAAA,MAAA;EAL1B;;;;;;;;;;;;;;;;;;;;;;;;IAdA,8BACH,2BACC,wBAAwB;KAEd,yBAAA,GAA4B,8BACvC,mCACA;KAEW,2BAA2B;+BAGvB,4BAA4B,kDAC/B,aAAa,KAAK,IAAI,OAC1B,mBAAmB,kCACxB,qCAGc,4BAA4B,kDAC/B,aAAa,KAAK,IAAI,OAC1B,mBAAmB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { c as ImageSnapshotTimeoutOptions, f as PixelDiffOptions, g as SsimDiffOptions, n as ComparisonMethod, o as ImageSnapshotKeyOptions, r as FailureThresholdOptions, s as ImageSnapshotSubjectOptions } from "./types-CEmjj-A9.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config/types.d.ts
|
|
4
|
+
type VisOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim' ? {
|
|
5
|
+
comparisonMethod: M;
|
|
6
|
+
/**
|
|
7
|
+
* Custom options passed to 'ssim'
|
|
8
|
+
*/
|
|
9
|
+
diffOptions?: Partial<SsimDiffOptions> | undefined;
|
|
10
|
+
} : {
|
|
11
|
+
comparisonMethod?: M | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Custom options passed to 'pixelmatch'
|
|
14
|
+
*/
|
|
15
|
+
diffOptions?: PixelDiffOptions | undefined;
|
|
16
|
+
}) & FailureThresholdOptions & ImageSnapshotTimeoutOptions & ImageSnapshotKeyOptions & ImageSnapshotSubjectOptions & {
|
|
17
|
+
/**
|
|
18
|
+
* Loads the `test.setupFiles` of the specified preset.
|
|
19
|
+
*
|
|
20
|
+
* Note:
|
|
21
|
+
* - 'enable` is deprecated. Use `manual` for the same effect.
|
|
22
|
+
* - 'none` is deprecated. Use `custom` for the same effect.
|
|
23
|
+
*
|
|
24
|
+
* @default 'auto'
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
preset?: 'enable' | 'manual' | 'auto' | 'custom' | 'none' | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The snapshot folder relative to the root of the project.
|
|
30
|
+
*
|
|
31
|
+
* Default: `{projectRoot}/__vis__/{platform}`
|
|
32
|
+
*/
|
|
33
|
+
snapshotRootDir?: string | ((context: {
|
|
34
|
+
ci: boolean;
|
|
35
|
+
browserName?: string | undefined;
|
|
36
|
+
providerName: string;
|
|
37
|
+
platform: string;
|
|
38
|
+
screenshotFailures?: boolean | undefined;
|
|
39
|
+
screenshotDirectory?: string | undefined;
|
|
40
|
+
}) => string) | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Customize the snapshot subpath.
|
|
43
|
+
*
|
|
44
|
+
* Typically, you place your test files either in a dedicated `tests` folder or in the `src` folder along with your source code.
|
|
45
|
+
* By default, the snapshot subpath is the test file path with that folder removed to reduces nesting of the snapshot folders.
|
|
46
|
+
*
|
|
47
|
+
* If you place your test files in multiple folders,
|
|
48
|
+
* such as in both `tests` and `src` folders,
|
|
49
|
+
* and they might have files with the same name and create conflicting snapshots,
|
|
50
|
+
* you can set this to customize the snapshot subpath.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Options for customizing the snapshot subpath.
|
|
53
|
+
* @property subPath - The path of the test file to be used as the snapshot subpath.
|
|
54
|
+
* To retain the full path, simply return it.
|
|
55
|
+
* @returns The customized snapshot subpath.
|
|
56
|
+
*/
|
|
57
|
+
snapshotSubpath?: ((options: {
|
|
58
|
+
subpath: string;
|
|
59
|
+
}) => string) | undefined;
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { VisOptions as t };
|
|
63
|
+
//# sourceMappingURL=types-DJYCbyT8.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DJYCbyT8.d.mts","names":[],"sources":["../src/config/types.ts"],"sourcesContent":[],"mappings":";;;KAcY,qBAAqB,+BAA+B;EAApD,gBAAU,EAED,CAFC;EAAW;;;EAMR,WAAA,CAAA,EAAR,OAAQ,CAAA,eAAA,CAAA,GAAA,SAAA;CAAR,GAAA;EAGK,gBAAA,CAAA,EAAA,CAAA,GAAA,SAAA;EAIL;;;EAIhB,WAAA,CAAA,EAJgB,gBAIhB,GAAA,SAAA;CACA,CAAA,GAHA,uBAGA,GAFA,2BAEA,GADA,uBACA,GAAA,2BAAA,GAAA;EAA2B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-plugin-vis",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Vitest visual testing plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"image-snapshot",
|
|
@@ -20,50 +20,51 @@
|
|
|
20
20
|
},
|
|
21
21
|
"type": "module",
|
|
22
22
|
"imports": {
|
|
23
|
-
"#vitest-plugin-vis/config": "./src/config.ts"
|
|
23
|
+
"#vitest-plugin-vis/config": "./src/config.ts",
|
|
24
|
+
"#vitest-plugin-vis/setup": "./src/setup.ts"
|
|
24
25
|
},
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
|
-
"types": "./
|
|
28
|
-
"default": "./
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
29
30
|
},
|
|
30
31
|
"./config": {
|
|
31
|
-
"types": "./
|
|
32
|
-
"default": "./
|
|
32
|
+
"types": "./dist/config.d.mts",
|
|
33
|
+
"default": "./dist/config.mjs"
|
|
33
34
|
},
|
|
34
35
|
"./client-api": {
|
|
35
|
-
"types": "./
|
|
36
|
-
"default": "./
|
|
36
|
+
"types": "./dist/client-api.d.mts",
|
|
37
|
+
"default": "./dist/client-api.mjs"
|
|
37
38
|
},
|
|
38
39
|
"./presets/auto": {
|
|
39
|
-
"types": "./
|
|
40
|
-
"default": "./
|
|
40
|
+
"types": "./dist/presets/auto.d.mts",
|
|
41
|
+
"default": "./dist/presets/auto.mjs"
|
|
41
42
|
},
|
|
42
43
|
"./presets/enable": {
|
|
43
|
-
"types": "./
|
|
44
|
-
"default": "./
|
|
44
|
+
"types": "./dist/presets/enable.d.mts",
|
|
45
|
+
"default": "./dist/presets/enable.mjs"
|
|
45
46
|
},
|
|
46
47
|
"./presets/manual": {
|
|
47
|
-
"types": "./
|
|
48
|
-
"default": "./
|
|
48
|
+
"types": "./dist/presets/manual.d.mts",
|
|
49
|
+
"default": "./dist/presets/manual.mjs"
|
|
49
50
|
},
|
|
50
51
|
"./server-utils": {
|
|
51
|
-
"types": "./
|
|
52
|
-
"default": "./
|
|
52
|
+
"types": "./dist/server-utils.d.mts",
|
|
53
|
+
"default": "./dist/server-utils.mjs"
|
|
53
54
|
},
|
|
54
55
|
"./setup": {
|
|
55
|
-
"types": "./
|
|
56
|
-
"default": "./
|
|
56
|
+
"types": "./dist/setup.d.mts",
|
|
57
|
+
"default": "./dist/setup.mjs"
|
|
57
58
|
},
|
|
58
59
|
"./testing": {
|
|
59
|
-
"types": "./
|
|
60
|
-
"default": "./
|
|
60
|
+
"types": "./dist/testing.d.mts",
|
|
61
|
+
"default": "./dist/testing.mjs"
|
|
61
62
|
},
|
|
62
63
|
"./package.json": "./package.json"
|
|
63
64
|
},
|
|
64
|
-
"types": "./
|
|
65
|
+
"types": "./dist/index.d.mts",
|
|
65
66
|
"files": [
|
|
66
|
-
"
|
|
67
|
+
"dist",
|
|
67
68
|
"src",
|
|
68
69
|
"!**/*.{spec,test,unit,accept,integrate,system,perf,stress}.*"
|
|
69
70
|
],
|
|
@@ -80,44 +81,58 @@
|
|
|
80
81
|
"type-plus": "8.0.0-beta.7"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|
|
83
|
-
"@repobuddy/storybook": "^2.
|
|
84
|
+
"@repobuddy/storybook": "^2.1.2",
|
|
84
85
|
"@repobuddy/typescript": "^2.1.0",
|
|
85
|
-
"@storybook-community/storybook-dark-mode": "^7.0.
|
|
86
|
-
"@storybook/addon-docs": "^10.0.
|
|
87
|
-
"@storybook/addon-vitest": "^
|
|
88
|
-
"@storybook/react-vite": "^
|
|
86
|
+
"@storybook-community/storybook-dark-mode": "^7.0.3",
|
|
87
|
+
"@storybook/addon-docs": "^10.2.0-alpha.1",
|
|
88
|
+
"@storybook/addon-vitest": "^10.2.0-alpha.1",
|
|
89
|
+
"@storybook/react-vite": "^10.2.0-alpha.1",
|
|
89
90
|
"@tailwindcss/vite": "^4.1.14",
|
|
90
91
|
"@types/is-ci": "^3.0.4",
|
|
91
92
|
"@types/pngjs": "^6.0.5",
|
|
92
93
|
"@types/react": "^19.2.2",
|
|
93
|
-
"@vitest/browser": "^
|
|
94
|
-
"@vitest/
|
|
95
|
-
"@vitest/
|
|
96
|
-
"@vitest/
|
|
94
|
+
"@vitest/browser": "^4.0.9",
|
|
95
|
+
"@vitest/browser-playwright": "^4.0.9",
|
|
96
|
+
"@vitest/browser-webdriverio": "^4.0.9",
|
|
97
|
+
"@vitest/coverage-istanbul": "^4.0.9",
|
|
98
|
+
"@vitest/coverage-v8": "^4.0.9",
|
|
99
|
+
"@vitest/expect": "^4.0.9",
|
|
100
|
+
"@vitest/ui": "4.0.9",
|
|
97
101
|
"cross-env": "^10.0.0",
|
|
98
102
|
"never-fail": "^1.1.4",
|
|
99
103
|
"npm-run-all2": "^8.0.0",
|
|
100
104
|
"react": "^19.0.0",
|
|
101
105
|
"react-dom": "^19.0.0",
|
|
102
|
-
"storybook": "^
|
|
103
|
-
"storybook-addon-tag-badges": "^3.0.
|
|
106
|
+
"storybook": "^10.2.0-alpha.1",
|
|
107
|
+
"storybook-addon-tag-badges": "^3.0.2",
|
|
104
108
|
"tailwindcss": "^4.1.14",
|
|
109
|
+
"tsdown": "^0.16.6",
|
|
105
110
|
"typescript": "^5.9.3",
|
|
106
111
|
"vite": "^7.1.12",
|
|
107
|
-
"vitest": "^
|
|
108
|
-
"vitest-browser-react": "^
|
|
112
|
+
"vitest": "^4.0.9",
|
|
113
|
+
"vitest-browser-react": "^2.0.2"
|
|
109
114
|
},
|
|
110
115
|
"peerDependencies": {
|
|
111
|
-
"@vitest/browser": "^
|
|
112
|
-
"vitest": "^
|
|
116
|
+
"@vitest/browser": "^4",
|
|
117
|
+
"@vitest/browser-playwright": "^4",
|
|
118
|
+
"@vitest/browser-webdriverio": "^4",
|
|
119
|
+
"vitest": "^4"
|
|
120
|
+
},
|
|
121
|
+
"peerDependenciesMeta": {
|
|
122
|
+
"@vitest/browser-playwright": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"@vitest/browser-webdriverio": {
|
|
126
|
+
"optional": true
|
|
127
|
+
}
|
|
113
128
|
},
|
|
114
129
|
"publishConfig": {
|
|
115
130
|
"access": "public"
|
|
116
131
|
},
|
|
117
132
|
"scripts": {
|
|
118
|
-
"build": "
|
|
133
|
+
"build": "tsdown",
|
|
119
134
|
"build:watch": "tsc -b tsconfig.esm.json -w",
|
|
120
|
-
"clean": "rimraf coverage esm --glob *.tsbuildinfo vitest.*.timestamp*",
|
|
135
|
+
"clean": "rimraf coverage dist esm --glob *.tsbuildinfo vitest.*.timestamp*",
|
|
121
136
|
"clean:vis:local": "rimraf __vis__/local",
|
|
122
137
|
"cov": "cross-env COVERAGE=true vitest run --coverage",
|
|
123
138
|
"coverage": "cross-env COVERAGE=true vitest run --coverage",
|
|
@@ -127,6 +142,7 @@
|
|
|
127
142
|
"sb": "storybook dev -p 6007",
|
|
128
143
|
"t:node": "vitest --project=vpv:node",
|
|
129
144
|
"t:pw": "vitest run --project=\"vpv:pw (*)\"",
|
|
145
|
+
"t:t": "tsc --noEmit",
|
|
130
146
|
"t:wd": "vitest run --project=\"vpv:wd (*)\"",
|
|
131
147
|
"test": "vitest run",
|
|
132
148
|
"test:u": "vitest run -u",
|
package/readme.md
CHANGED
|
@@ -26,6 +26,7 @@ The [`vitest-plugin-vis`][vitest-plugin-vis] plugin can be used without customiz
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
// vitest.config.ts
|
|
29
|
+
import { playwright } from '@vitest/browser-playwright'
|
|
29
30
|
import { defineConfig } from 'vitest/config'
|
|
30
31
|
import { vis } from 'vitest-plugin-vis/config'
|
|
31
32
|
|
|
@@ -45,6 +46,14 @@ export default defineConfig({
|
|
|
45
46
|
instances: [
|
|
46
47
|
{ browser: 'chromium' }
|
|
47
48
|
]
|
|
49
|
+
},
|
|
50
|
+
// vitest v4
|
|
51
|
+
browser: {
|
|
52
|
+
enabled: true,
|
|
53
|
+
provider: playwright(),
|
|
54
|
+
instances: [
|
|
55
|
+
{ browser: 'chromium' }
|
|
56
|
+
]
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
})
|
|
@@ -166,7 +175,50 @@ By default, the plugin will trim the common folder such as `src` or `test` from
|
|
|
166
175
|
If you place your test files in multiple folders,
|
|
167
176
|
such as in both `tests` and `src` folders,
|
|
168
177
|
and they might have files with the same name and create conflicting snapshots,
|
|
169
|
-
you can customize
|
|
178
|
+
you can use `snapshotSubpath` to customize the snapshot sub-path to avoid conflicts.
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
// vitest.config.ts
|
|
182
|
+
import { storybookVis } from 'storybook-addon-vis/vitest-plugin'
|
|
183
|
+
import { defineConfig } from 'vitest/config'
|
|
184
|
+
|
|
185
|
+
export default defineConfig({
|
|
186
|
+
plugins: [
|
|
187
|
+
storybookVis({
|
|
188
|
+
// keep the folder structure
|
|
189
|
+
snapshotSubpath: (subpath) => subpath
|
|
190
|
+
})
|
|
191
|
+
],
|
|
192
|
+
// ...
|
|
193
|
+
})
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
With the above configuration, the snapshot folder structure will look like this:
|
|
197
|
+
|
|
198
|
+
```ini
|
|
199
|
+
v __vis__
|
|
200
|
+
> # ...
|
|
201
|
+
v local # snapshot generated on local machine
|
|
202
|
+
> __baselines__
|
|
203
|
+
v examples
|
|
204
|
+
v button.stories.tsx
|
|
205
|
+
snapshot-1.png
|
|
206
|
+
snapshot-2.png
|
|
207
|
+
v src
|
|
208
|
+
v button.stories.tsx
|
|
209
|
+
snapshot-1.png
|
|
210
|
+
snapshot-2.png
|
|
211
|
+
v tests
|
|
212
|
+
v button.stories.tsx
|
|
213
|
+
snapshot-1.png
|
|
214
|
+
snapshot-2.png
|
|
215
|
+
v examples
|
|
216
|
+
button.stories.tsx
|
|
217
|
+
v src
|
|
218
|
+
button.stories.tsx
|
|
219
|
+
v tests
|
|
220
|
+
button.stories.tsx
|
|
221
|
+
```
|
|
170
222
|
|
|
171
223
|
> `MyComponent/className/can-customize-className`: `snapshotId`
|
|
172
224
|
|
|
@@ -231,7 +283,7 @@ You can also customize the subject per test using the `setAutoSnapshotOptions` f
|
|
|
231
283
|
|
|
232
284
|
```ts
|
|
233
285
|
// some.test.ts
|
|
234
|
-
import { page } from '
|
|
286
|
+
import { page } from 'vitest/browser'
|
|
235
287
|
import { expect, it } from 'vitest'
|
|
236
288
|
import { render } from 'vitest-browser-react'
|
|
237
289
|
import { setAutoSnapshotOptions } from 'vitest-plugin-vis'
|
|
@@ -386,7 +438,7 @@ You can take snapshots manually:
|
|
|
386
438
|
```ts
|
|
387
439
|
// some.test.ts
|
|
388
440
|
import { render } from 'vitest-browser-react'
|
|
389
|
-
import { page } from '
|
|
441
|
+
import { page } from 'vitest/browser'
|
|
390
442
|
import { it } from 'vitest'
|
|
391
443
|
|
|
392
444
|
it('manual snapshot', async ({ expect }) => {
|
|
@@ -403,7 +455,7 @@ You can customize the snapshot comparison options per assertion:
|
|
|
403
455
|
```ts
|
|
404
456
|
// some.test.ts
|
|
405
457
|
import { render } from 'vitest-browser-react'
|
|
406
|
-
import { page } from '
|
|
458
|
+
import { page } from 'vitest/browser'
|
|
407
459
|
import { it } from 'vitest'
|
|
408
460
|
|
|
409
461
|
it('manual snapshot with options', async ({ expect }) => {
|
|
@@ -426,7 +478,7 @@ it('manual snapshot with options', async ({ expect }) => {
|
|
|
426
478
|
You can also take a full page snapshot:
|
|
427
479
|
|
|
428
480
|
```ts
|
|
429
|
-
import { page } from '
|
|
481
|
+
import { page } from 'vitest/browser'
|
|
430
482
|
import { it } from 'vitest'
|
|
431
483
|
|
|
432
484
|
it('full page snapshot', async () => {
|
|
@@ -439,7 +491,7 @@ it('full page snapshot', async () => {
|
|
|
439
491
|
While less common, you can also check if a snapshot exists:
|
|
440
492
|
|
|
441
493
|
```ts
|
|
442
|
-
import { page } from '
|
|
494
|
+
import { page } from 'vitest/browser'
|
|
443
495
|
import { it } from 'vitest'
|
|
444
496
|
|
|
445
497
|
it('Has Snapshot', async ({ expect }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HasImageSnapshotCommand, ImageSnapshotNextIndexCommand } from '../../commands.ts'
|
|
1
|
+
import type { HasImageSnapshotCommand, ImageSnapshotNextIndexCommand } from '../../shared/commands.types.ts'
|
|
2
2
|
import type { ImageSnapshotKeyOptions } from '../../shared/types.ts'
|
|
3
3
|
|
|
4
4
|
export function hasImageSnapshotAction(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LoadImageSnapshotResultsCommand } from '../../
|
|
1
|
+
import type { LoadImageSnapshotResultsCommand } from '../../shared/commands.types.ts'
|
|
2
2
|
|
|
3
3
|
export function loadImageSnapshotResultsAction(commands: LoadImageSnapshotResultsCommand, taskId: string) {
|
|
4
4
|
return commands.loadImageSnapshotResults(taskId)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import type { BrowserCommands } from '
|
|
2
|
-
import type { ImageSnapshotNextIndexCommand } from '../../commands.ts'
|
|
3
|
-
import type { PrepareImageSnapshotComparisonCommand } from '../../server/commands/prepare_image_snapshot_comparison.ts'
|
|
1
|
+
import type { BrowserCommands } from 'vitest/browser'
|
|
4
2
|
import { assertSnapshotKeyWithoutDash } from '../../shared/asserts.ts'
|
|
5
3
|
import { isBase64String } from '../../shared/base64.ts'
|
|
4
|
+
import type {
|
|
5
|
+
ImageSnapshotNextIndexCommand,
|
|
6
|
+
PrepareImageSnapshotComparisonCommand,
|
|
7
|
+
} from '../../shared/commands.types.ts'
|
|
6
8
|
import type { ToMatchImageSnapshotOptions } from '../../shared/types.ts'
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
+
import { convertElementToCssSelector } from '../external/browser/selector.ts'
|
|
10
|
+
import { compareImageSnapshot } from '../snapshot/compare_image_snapshot.ts'
|
|
9
11
|
|
|
10
12
|
export async function matchImageSnapshotAction(
|
|
11
13
|
commands: BrowserCommands & PrepareImageSnapshotComparisonCommand & ImageSnapshotNextIndexCommand,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { BrowserCommands } from '
|
|
2
|
-
import type { ImageSnapshotNextIndexCommand } from '../../commands.ts'
|
|
3
|
-
import type { PrepareImageSnapshotComparisonCommand } from '../../server/commands/prepare_image_snapshot_comparison.ts'
|
|
1
|
+
import type { BrowserCommands } from 'vitest/browser'
|
|
4
2
|
import { assertSnapshotKeyWithoutDash } from '../../shared/asserts.ts'
|
|
3
|
+
import type {
|
|
4
|
+
ImageSnapshotNextIndexCommand,
|
|
5
|
+
PrepareImageSnapshotComparisonCommand,
|
|
6
|
+
} from '../../shared/commands.types.ts'
|
|
5
7
|
import type { ToMatchImageSnapshotOptions } from '../../shared/types.ts'
|
|
6
|
-
import { compareImageSnapshot } from '../compare_image_snapshot.ts'
|
|
8
|
+
import { compareImageSnapshot } from '../snapshot/compare_image_snapshot.ts'
|
|
7
9
|
|
|
8
10
|
export async function matchPageImageSnapshotAction(
|
|
9
11
|
commands: BrowserCommands & PrepareImageSnapshotComparisonCommand & ImageSnapshotNextIndexCommand,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { commands } from '@vitest/browser/context'
|
|
2
1
|
import type { AsyncExpectationResult } from '@vitest/expect'
|
|
3
2
|
import type { ToMatchImageSnapshotOptions } from '../../shared/types.ts'
|
|
4
3
|
import { matchImageSnapshotAction } from '../actions/match_image_snapshot_action.ts'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { toTaskId } from '../task/task_id.ts'
|
|
5
|
+
import { ctx } from './_ctx.ts'
|
|
7
6
|
import { success } from './expectation_result.ts'
|
|
8
7
|
|
|
9
8
|
export function toMatchImageSnapshot(
|
|
@@ -26,5 +25,5 @@ export function toMatchImageSnapshot(
|
|
|
26
25
|
)
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
return matchImageSnapshotAction(commands, toTaskId(test), subject, options).then(() => success)
|
|
28
|
+
return matchImageSnapshotAction(ctx.commands, toTaskId(test), subject, options).then(() => success)
|
|
30
29
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { BrowserCommands, Platform } from '@vitest/browser/context'
|
|
2
1
|
import type { SerializedConfig } from 'vitest'
|
|
2
|
+
import type { BrowserCommands, Platform } from 'vitest/browser'
|
|
3
3
|
|
|
4
|
-
let ctx: Awaited<typeof import('
|
|
4
|
+
let ctx: Awaited<typeof import('vitest/browser')>
|
|
5
5
|
|
|
6
6
|
if ((globalThis as any).__vitest_browser__) {
|
|
7
|
-
import('
|
|
7
|
+
import('vitest/browser').then((m) => {
|
|
8
8
|
ctx = m
|
|
9
9
|
})
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getMaxSize } from '
|
|
2
|
-
import { isSameSize } from '
|
|
3
|
-
import { createImageResizer } from '
|
|
1
|
+
import { getMaxSize } from '../../shared/get_max_size.ts'
|
|
2
|
+
import { isSameSize } from '../../shared/is_same_size.ts'
|
|
3
|
+
import { createImageResizer } from '../external/browser/image_resizer.ts'
|
|
4
4
|
|
|
5
5
|
export function alignImagesToSameSize(image1: ImageData, image2: ImageData): [image1: ImageData, image2: ImageData] {
|
|
6
6
|
if (isSameSize(image1, image2)) return [image1, image2] as const
|