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
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type BrowserPage } from '@vitest/browser/context';
|
|
2
|
-
import type { ImageSnapshotKeyOptions } from '../../shared/types.ts';
|
|
3
|
-
export interface HasImageSnapshotAction {
|
|
4
|
-
/**
|
|
5
|
-
* Check if the snapshot image exists.
|
|
6
|
-
*/
|
|
7
|
-
hasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined): Promise<boolean>;
|
|
8
|
-
}
|
|
9
|
-
export declare function hasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined): Promise<boolean>;
|
|
10
|
-
//# sourceMappingURL=has_image_snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has_image_snapshot.d.ts","sourceRoot":"","sources":["../../../src/client/page/has_image_snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,yBAAyB,CAAA;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAKpE,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,oBAahG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { commands } from '@vitest/browser/context';
|
|
2
|
-
import { hasImageSnapshotAction } from "../actions/has_image_snapshot_action.js";
|
|
3
|
-
import { ctx } from "../ctx.js";
|
|
4
|
-
import { toTaskId } from "../task_id.js";
|
|
5
|
-
export function hasImageSnapshot(options) {
|
|
6
|
-
const test = ctx.getCurrentTest();
|
|
7
|
-
if (!test) {
|
|
8
|
-
throw new Error('`hasImageSnapshot()` must be called in a test.');
|
|
9
|
-
}
|
|
10
|
-
if (test.concurrent) {
|
|
11
|
-
throw new Error('`hasImageSnapshot()` cannot be called in a concurrent test because ' +
|
|
12
|
-
"concurrent tests run at the same time in the same iframe and affect each other's environment. ");
|
|
13
|
-
}
|
|
14
|
-
return hasImageSnapshotAction(commands, toTaskId(test), options);
|
|
15
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ComparisonMethod, ToMatchPageImageSnapshotOptions } from '../../shared/types.ts';
|
|
2
|
-
export interface ToMatchImageSnapshotAction {
|
|
3
|
-
toMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(options?: ToMatchPageImageSnapshotOptions<M> | undefined): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
export declare function toMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(options?: ToMatchPageImageSnapshotOptions<M> | undefined): Promise<void>;
|
|
6
|
-
//# sourceMappingURL=to_match_image_snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to_match_image_snapshot.d.ts","sourceRoot":"","sources":["../../../src/client/page/to_match_image_snapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AAK9F,MAAM,WAAW,0BAA0B;IAC1C,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,EACxD,OAAO,CAAC,EAAE,+BAA+B,CAAC,CAAC,CAAC,GAAG,SAAS,GACtD,OAAO,CAAC,IAAI,CAAC,CAAA;CAChB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,EACxE,OAAO,CAAC,EAAE,+BAA+B,CAAC,CAAC,CAAC,GAAG,SAAS,iBAexD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { commands } from '@vitest/browser/context';
|
|
2
|
-
import { matchPageImageSnapshotAction } from "../actions/match_page_image_snapshot_action.js";
|
|
3
|
-
import { ctx } from "../ctx.js";
|
|
4
|
-
import { toTaskId } from "../task_id.js";
|
|
5
|
-
export function toMatchImageSnapshot(options) {
|
|
6
|
-
const test = ctx.getCurrentTest();
|
|
7
|
-
if (!test) {
|
|
8
|
-
throw new Error('`toMatchImageSnapshot()` must be called in a test.');
|
|
9
|
-
}
|
|
10
|
-
if (test.concurrent) {
|
|
11
|
-
throw new Error('`toMatchImageSnapshot()` cannot be called in a concurrent test because ' +
|
|
12
|
-
"concurrent tests run at the same time in the same iframe and affect each other's environment.");
|
|
13
|
-
}
|
|
14
|
-
return matchPageImageSnapshotAction(commands, toTaskId(test), options);
|
|
15
|
-
}
|
package/esm/client/selector.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Most of the code in this file is copied from Vitest.
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/vitest-dev/vitest/blob/main/packages/browser/src/client/utils.ts
|
|
5
|
-
*/
|
|
6
|
-
export declare function convertElementToCssSelector(element: Element): string;
|
|
7
|
-
//# sourceMappingURL=selector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/client/selector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,UAM3D"}
|
package/esm/client/selector.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Most of the code in this file is copied from Vitest.
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/vitest-dev/vitest/blob/main/packages/browser/src/client/utils.ts
|
|
5
|
-
*/
|
|
6
|
-
export function convertElementToCssSelector(element) {
|
|
7
|
-
if (!element || !(element instanceof Element)) {
|
|
8
|
-
throw new Error(`Expected DOM element to be an instance of Element, received ${typeof element}`);
|
|
9
|
-
}
|
|
10
|
-
return getUniqueCssSelector(element);
|
|
11
|
-
}
|
|
12
|
-
function escapeIdForCSSSelector(id) {
|
|
13
|
-
return id
|
|
14
|
-
.split('')
|
|
15
|
-
.map((char) => {
|
|
16
|
-
const code = char.charCodeAt(0);
|
|
17
|
-
if (char === ' ' ||
|
|
18
|
-
char === '#' ||
|
|
19
|
-
char === '.' ||
|
|
20
|
-
char === ':' ||
|
|
21
|
-
char === '[' ||
|
|
22
|
-
char === ']' ||
|
|
23
|
-
char === '>' ||
|
|
24
|
-
char === '+' ||
|
|
25
|
-
char === '~' ||
|
|
26
|
-
char === '\\') {
|
|
27
|
-
// Escape common special characters with backslashes
|
|
28
|
-
return `\\${char}`;
|
|
29
|
-
}
|
|
30
|
-
if (code >= 0x10000) {
|
|
31
|
-
// Unicode escape for characters outside the BMP
|
|
32
|
-
return `\\${code.toString(16).toUpperCase().padStart(6, '0')} `;
|
|
33
|
-
}
|
|
34
|
-
if (code < 0x20 || code === 0x7f) {
|
|
35
|
-
// Non-printable ASCII characters (0x00-0x1F and 0x7F) are escaped
|
|
36
|
-
return `\\${code.toString(16).toUpperCase().padStart(2, '0')} `;
|
|
37
|
-
}
|
|
38
|
-
if (code >= 0x80) {
|
|
39
|
-
// Non-ASCII characters (0x80 and above) are escaped
|
|
40
|
-
return `\\${code.toString(16).toUpperCase().padStart(2, '0')} `;
|
|
41
|
-
}
|
|
42
|
-
// Allowable characters are used directly
|
|
43
|
-
return char;
|
|
44
|
-
})
|
|
45
|
-
.join('');
|
|
46
|
-
}
|
|
47
|
-
function getUniqueCssSelector(el) {
|
|
48
|
-
const path = [];
|
|
49
|
-
let parent;
|
|
50
|
-
let hasShadowRoot = false;
|
|
51
|
-
// eslint-disable-next-line no-cond-assign
|
|
52
|
-
while ((parent = getParent(el))) {
|
|
53
|
-
if (parent.shadowRoot) {
|
|
54
|
-
hasShadowRoot = true;
|
|
55
|
-
}
|
|
56
|
-
const tag = el.tagName;
|
|
57
|
-
if (el.id) {
|
|
58
|
-
path.push(`#${escapeIdForCSSSelector(el.id)}`);
|
|
59
|
-
}
|
|
60
|
-
else if (!el.nextElementSibling && !el.previousElementSibling) {
|
|
61
|
-
path.push(tag.toLowerCase());
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
let index = 0;
|
|
65
|
-
let sameTagSiblings = 0;
|
|
66
|
-
let elementIndex = 0;
|
|
67
|
-
for (const sibling of parent.children) {
|
|
68
|
-
index++;
|
|
69
|
-
if (sibling.tagName === tag) {
|
|
70
|
-
sameTagSiblings++;
|
|
71
|
-
}
|
|
72
|
-
if (sibling === el) {
|
|
73
|
-
elementIndex = index;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (sameTagSiblings > 1) {
|
|
77
|
-
path.push(`${tag.toLowerCase()}:nth-child(${elementIndex})`);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
path.push(tag.toLowerCase());
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
el = parent;
|
|
84
|
-
}
|
|
85
|
-
return `${getBrowserState().provider === 'webdriverio' && hasShadowRoot ? '>>>' : ''}${path.reverse().join(' > ')}`;
|
|
86
|
-
}
|
|
87
|
-
function getParent(el) {
|
|
88
|
-
const parent = el.parentNode;
|
|
89
|
-
if (parent instanceof ShadowRoot) {
|
|
90
|
-
return parent.host;
|
|
91
|
-
}
|
|
92
|
-
return parent;
|
|
93
|
-
}
|
|
94
|
-
function getBrowserState() {
|
|
95
|
-
// @ts-expect-error not typed global
|
|
96
|
-
return window.__vitest_browser_runner__;
|
|
97
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { SetupVisSuiteCommand } from '../../server/commands/setup_vis_suite.ts';
|
|
2
|
-
import type { ComparisonMethod } from '../../shared/types.ts';
|
|
3
|
-
import type { SnapshotMeta } from '../snapshot_meta.ts';
|
|
4
|
-
/**
|
|
5
|
-
* Visual test configuration on the client side.
|
|
6
|
-
*/
|
|
7
|
-
export type VisClientConfigurator<GM extends Record<string, any> | unknown = unknown> = {
|
|
8
|
-
/**
|
|
9
|
-
* Setup the visual test configuration.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* // Setup with auto snapshot enabled
|
|
14
|
-
* vis().setup({ auto: true })
|
|
15
|
-
*
|
|
16
|
-
* // Setup with auto snapshot disabled
|
|
17
|
-
* vis().setup({ auto: false })
|
|
18
|
-
*
|
|
19
|
-
* // Same as `vis.setup({ auto: false })`
|
|
20
|
-
* vis.setup()
|
|
21
|
-
*
|
|
22
|
-
* // Setup with auto snapshot determined by the test meta
|
|
23
|
-
* vis.setup({
|
|
24
|
-
* auto: async ({ meta }) => meta['darkOnly'],
|
|
25
|
-
* })
|
|
26
|
-
*
|
|
27
|
-
* // Setup with multiple auto snapshots
|
|
28
|
-
* vis.setup({
|
|
29
|
-
* auto: {
|
|
30
|
-
* async light() { document.body.classList.remove('dark') },
|
|
31
|
-
* async dark() { document.body.classList.add('dark') },
|
|
32
|
-
* }
|
|
33
|
-
* })
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
setup(options?: {
|
|
37
|
-
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)>;
|
|
38
|
-
}): void;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated Use `vis.setup()` instead.
|
|
41
|
-
*/
|
|
42
|
-
presets: {
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use `vis.setup()` instead.
|
|
45
|
-
*
|
|
46
|
-
* Enable visual testing.
|
|
47
|
-
*
|
|
48
|
-
* auto snapshot is turned off by default.
|
|
49
|
-
* You can specify the test to take a snapshot during `afterEach()` hook with `setAutoSnapshotOptions()`.
|
|
50
|
-
*/
|
|
51
|
-
enable(): void;
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated Use `vis.setup()` instead.
|
|
54
|
-
*
|
|
55
|
-
* Enable visual testing.
|
|
56
|
-
*
|
|
57
|
-
* `setAutoSnapshotOptions` will have no effect in this preset.
|
|
58
|
-
*/
|
|
59
|
-
manual(): void;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Use `vis.setup()` instead.
|
|
62
|
-
*
|
|
63
|
-
* Enable automatic visual testing.
|
|
64
|
-
*
|
|
65
|
-
* This will take a snapshot after each test.
|
|
66
|
-
*/
|
|
67
|
-
auto(): void;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Use `vis.setup()` instead.
|
|
70
|
-
*
|
|
71
|
-
* Enable automatic visual testing with multiple themes.
|
|
72
|
-
*
|
|
73
|
-
* This will take a snapshot after each test for each theme.
|
|
74
|
-
*
|
|
75
|
-
* @param themes A record of theme names and their setup functions.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* vis().presets.theme({
|
|
80
|
-
* light() { document.body.classList.add('light') },
|
|
81
|
-
* dark() { document.body.classList.add('dark') },
|
|
82
|
-
* })
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
theme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(themes: Record<string, boolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)>): void;
|
|
86
|
-
};
|
|
87
|
-
beforeAll: {
|
|
88
|
-
setup(): Promise<void>;
|
|
89
|
-
};
|
|
90
|
-
afterEach: {
|
|
91
|
-
matchImageSnapshot(): Promise<void>;
|
|
92
|
-
matchPerTheme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(themes: Record<string, boolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)>): () => Promise<void>;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
export declare function createVis<GM extends Record<string, any> | unknown = unknown>(commands: SetupVisSuiteCommand): VisClientConfigurator<GM>;
|
|
96
|
-
//# sourceMappingURL=create_vis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create_vis.d.ts","sourceRoot":"","sources":["../../../src/client/setup/create_vis.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,IAAI;IACvF;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QACf,IAAI,CAAC,EACF,OAAO,GACP,CAAC,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAC/E,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAC5B,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,GACvD,MAAM,CACN,MAAM,EACJ,OAAO,GACP,CAAC,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAC/E,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAC5B,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CACxD,CAAA;KACJ,GAAG,IAAI,CAAA;IACR;;OAEG;IACH,OAAO,EAAE;QACR;;;;;;;WAOG;QACH,MAAM,IAAI,IAAI,CAAA;QACd;;;;;;WAMG;QACH,MAAM,IAAI,IAAI,CAAA;QACd;;;;;;WAMG;QACH,IAAI,IAAI,IAAI,CAAA;QACZ;;;;;;;;;;;;;;;;WAgBG;QACH,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAClF,MAAM,EAAE,MAAM,CACb,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CACpG,GACC,IAAI,CAAA;KACP,CAAA;IACD,SAAS,EAAE;QACV,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACtB,CAAA;IACD,SAAS,EAAE;QACV,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;QACnC,aAAa,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAC1F,MAAM,EAAE,MAAM,CACb,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CACpG,GACC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KACtB,CAAA;CACD,CAAA;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,oBAAoB,6BAmG3G"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
import { afterEach, beforeAll } from 'vitest';
|
|
3
|
-
import { extractAutoSnapshotOptions, setAutoSnapshotOptions } from "../auto_snapshot_options.js";
|
|
4
|
-
import { ctx } from "../ctx.js";
|
|
5
|
-
import { shouldTakeSnapshot } from "../should_take_snapshot.js";
|
|
6
|
-
import { toTaskId } from "../task_id.js";
|
|
7
|
-
export function createVis(commands) {
|
|
8
|
-
let subject;
|
|
9
|
-
const vis = {
|
|
10
|
-
setup(options) {
|
|
11
|
-
if (!options || options.auto === false) {
|
|
12
|
-
beforeAll(vis.beforeAll.setup);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
beforeAll(async () => {
|
|
16
|
-
await vis.beforeAll.setup();
|
|
17
|
-
setAutoSnapshotOptions(true);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
if (typeof options?.auto === 'function') {
|
|
21
|
-
afterEach(vis.afterEach.matchPerTheme({
|
|
22
|
-
auto: options.auto,
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
else if (typeof options?.auto === 'object') {
|
|
26
|
-
afterEach(vis.afterEach.matchPerTheme(options.auto));
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
afterEach(vis.afterEach.matchImageSnapshot);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
presets: {
|
|
33
|
-
enable() {
|
|
34
|
-
beforeAll(vis.beforeAll.setup);
|
|
35
|
-
afterEach(vis.afterEach.matchImageSnapshot);
|
|
36
|
-
},
|
|
37
|
-
manual() {
|
|
38
|
-
beforeAll(vis.beforeAll.setup);
|
|
39
|
-
},
|
|
40
|
-
auto() {
|
|
41
|
-
beforeAll(async () => {
|
|
42
|
-
await vis.beforeAll.setup();
|
|
43
|
-
setAutoSnapshotOptions(true);
|
|
44
|
-
});
|
|
45
|
-
afterEach(vis.afterEach.matchImageSnapshot);
|
|
46
|
-
},
|
|
47
|
-
theme(themes) {
|
|
48
|
-
beforeAll(async () => {
|
|
49
|
-
await vis.beforeAll.setup();
|
|
50
|
-
setAutoSnapshotOptions(true);
|
|
51
|
-
});
|
|
52
|
-
afterEach(vis.afterEach.matchPerTheme(themes));
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
beforeAll: {
|
|
56
|
-
async setup() {
|
|
57
|
-
subject = (await commands.setupVisSuite()).subject;
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
afterEach: {
|
|
61
|
-
async matchImageSnapshot() {
|
|
62
|
-
return vis.afterEach.matchPerTheme({ async auto() { } })();
|
|
63
|
-
},
|
|
64
|
-
matchPerTheme(themes) {
|
|
65
|
-
return async function matchImageSnapshot() {
|
|
66
|
-
const test = ctx.getCurrentTest();
|
|
67
|
-
if ((test?.result?.errors?.length ?? 0) > 0)
|
|
68
|
-
return;
|
|
69
|
-
const meta = extractAutoSnapshotOptions(test);
|
|
70
|
-
if (!shouldTakeSnapshot(meta))
|
|
71
|
-
return;
|
|
72
|
-
const errors = [];
|
|
73
|
-
for (const themeId in themes) {
|
|
74
|
-
try {
|
|
75
|
-
await new Promise((a) => setTimeout(a, 10));
|
|
76
|
-
const theme = themes[themeId];
|
|
77
|
-
const r = typeof theme === 'function' ? await theme(meta) : theme;
|
|
78
|
-
if (r === false)
|
|
79
|
-
continue;
|
|
80
|
-
await test.context.expect(getSubject(meta?.subject ?? subject)).toMatchImageSnapshot({
|
|
81
|
-
...meta,
|
|
82
|
-
snapshotKey: meta?.snapshotKey ?? themeId,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
errors.push([themeId, error]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (errors.length > 0) {
|
|
90
|
-
if (errors.length === 1)
|
|
91
|
-
throw errors[0][1];
|
|
92
|
-
const taskId = toTaskId(test);
|
|
93
|
-
throw new AggregateError(errors, dedent `Snapshot \`${taskId}\` mismatched
|
|
94
|
-
|
|
95
|
-
${errors
|
|
96
|
-
.map(([themeId, error]) => {
|
|
97
|
-
return `Theme \`${themeId}\` failed: ${error.message}`;
|
|
98
|
-
})
|
|
99
|
-
.join('\n\n')}`);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
return vis;
|
|
106
|
-
}
|
|
107
|
-
function getSubject(selectors) {
|
|
108
|
-
return selectors ? (document.querySelector(selectors) ?? document.body) : document.body;
|
|
109
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeAll, beforeEach, type Awaitable, type Suite } from 'vitest';
|
|
2
|
-
export declare const ctx: {
|
|
3
|
-
beforeAll: typeof beforeAll;
|
|
4
|
-
beforeEach: typeof beforeEach;
|
|
5
|
-
afterEach: typeof afterEach;
|
|
6
|
-
commands: import("@vitest/browser/context").BrowserCommands;
|
|
7
|
-
mock(): {
|
|
8
|
-
beforeAllListeners: ((suite: Readonly<Suite | File>) => Awaitable<unknown>)[];
|
|
9
|
-
};
|
|
10
|
-
reset(): void;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=vis.ctx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vis.ctx.d.ts","sourceRoot":"","sources":["../../../src/client/setup/vis.ctx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAM,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEzF,eAAO,MAAM,GAAG;;;;;;qCAM0B,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC;;;CAuBtF,CAAA"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { commands } from '@vitest/browser/context';
|
|
2
|
-
import { afterEach, beforeAll, beforeEach, vi } from 'vitest';
|
|
3
|
-
export const ctx = {
|
|
4
|
-
beforeAll,
|
|
5
|
-
beforeEach,
|
|
6
|
-
afterEach,
|
|
7
|
-
commands,
|
|
8
|
-
mock() {
|
|
9
|
-
const beforeAllListeners = [];
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
ctx.beforeAll = vi.fn((fn) => {
|
|
12
|
-
beforeAllListeners.push(fn);
|
|
13
|
-
});
|
|
14
|
-
ctx.beforeEach = vi.fn();
|
|
15
|
-
ctx.afterEach = vi.fn();
|
|
16
|
-
ctx.commands = {
|
|
17
|
-
setupVisSuite: vi.fn(),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
afterEach(() => {
|
|
21
|
-
ctx.reset();
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
beforeAllListeners,
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
reset() {
|
|
28
|
-
ctx.beforeAll = beforeAll;
|
|
29
|
-
ctx.beforeEach = beforeEach;
|
|
30
|
-
ctx.afterEach = afterEach;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vis.d.ts","sourceRoot":"","sources":["../../../src/client/setup/vis.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,GAAG,0DAAsB,CAAA"}
|
package/esm/client/setup/vis.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"should_take_snapshot.d.ts","sourceRoot":"","sources":["../../src/client/should_take_snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,SAAS,uBAErE"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ComparisonMethod, ImageSnapshotSubjectOptions, ToMatchImageSnapshotOptions } from '../shared/types.ts';
|
|
2
|
-
export type SnapshotMeta<M extends ComparisonMethod> = ToMatchImageSnapshotOptions<M> & ImageSnapshotSubjectOptions & {
|
|
3
|
-
enable?: boolean | undefined;
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=snapshot_meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot_meta.d.ts","sourceRoot":"","sources":["../../src/client/snapshot_meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAEpH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,gBAAgB,IAAI,2BAA2B,CAAC,CAAC,CAAC,GACpF,2BAA2B,GAAG;IAC7B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/client/task_id.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task_id.d.ts","sourceRoot":"","sources":["../../src/client/task_id.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,CAAA;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,UAUlC"}
|
package/esm/client/task_id.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function toTaskId(task) {
|
|
2
|
-
const l = [];
|
|
3
|
-
let t = task;
|
|
4
|
-
while (t?.suite) {
|
|
5
|
-
l.unshift(t.suite.name.replace(/[^a-z0-9]/gi, '-').toLowerCase());
|
|
6
|
-
t = t.suite;
|
|
7
|
-
}
|
|
8
|
-
l.push(task.name.replace(/[^a-z0-9]/gi, '-').toLowerCase());
|
|
9
|
-
return l.join('/');
|
|
10
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommands, Platform } from '@vitest/browser/context';
|
|
2
|
-
import type { SerializedConfig } from 'vitest';
|
|
3
|
-
export declare const server: {
|
|
4
|
-
/**
|
|
5
|
-
* Platform the Vitest server is running on.
|
|
6
|
-
* The same as calling `process.platform` on the server.
|
|
7
|
-
*/
|
|
8
|
-
platform: Platform;
|
|
9
|
-
/**
|
|
10
|
-
* Runtime version of the Vitest server.
|
|
11
|
-
* The same as calling `process.version` on the server.
|
|
12
|
-
*/
|
|
13
|
-
version: string;
|
|
14
|
-
/**
|
|
15
|
-
* Name of the browser provider.
|
|
16
|
-
*/
|
|
17
|
-
provider: string;
|
|
18
|
-
/**
|
|
19
|
-
* Name of the current browser.
|
|
20
|
-
*/
|
|
21
|
-
browser: string;
|
|
22
|
-
/**
|
|
23
|
-
* Available commands for the browser.
|
|
24
|
-
* @see {@link https://vitest.dev/guide/browser/commands}
|
|
25
|
-
*/
|
|
26
|
-
commands: BrowserCommands;
|
|
27
|
-
/**
|
|
28
|
-
* Serialized test config.
|
|
29
|
-
*/
|
|
30
|
-
config: SerializedConfig;
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=vitest_browser_context_proxy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vitest_browser_context_proxy.d.ts","sourceRoot":"","sources":["../../src/client/vitest_browser_context_proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAU9C,eAAO,MAAM,MAAM;IAClB;;;OAGG;cACO,QAAQ;IAClB;;;OAGG;aACM,MAAM;IACf;;OAEG;cACO,MAAM;IAChB;;OAEG;aACM,MAAM;IACf;;;OAGG;cACO,eAAe;IACzB;;OAEG;YACK,gBAAgB;CAKvB,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SnapshotTestMeta } from '../shared/types.ts';
|
|
2
|
-
declare let vitestSuite: Awaited<typeof import('vitest/suite')>;
|
|
3
|
-
export type CurrentTest = ReturnType<typeof vitestSuite.getCurrentTest> & SnapshotTestMeta;
|
|
4
|
-
export declare const getCurrentTest: () => CurrentTest;
|
|
5
|
-
export declare const getCurrentSuite: () => import("vitest").SuiteCollector<object>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=vitest_suite_proxy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vitest_suite_proxy.d.ts","sourceRoot":"","sources":["../../src/client/vitest_suite_proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,QAAA,IAAI,WAAW,EAAE,OAAO,CAAC,cAAc,cAAc,CAAC,CAAC,CAAA;AAQvD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAA;AAE1F,eAAO,MAAM,cAAc,QAA0C,WAAW,CAAA;AAChF,eAAO,MAAM,eAAe,+CAAuC,CAAA"}
|
package/esm/client-api.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import './server/commands/augment.ts';
|
|
2
|
-
export * from './client/actions/has_image_snapshot_action.ts';
|
|
3
|
-
export * from './client/actions/load_image_snapshot_results_action.ts';
|
|
4
|
-
export * from './client/actions/match_image_snapshot_action.ts';
|
|
5
|
-
export * from './client/actions/match_page_image_snapshot_action.ts';
|
|
6
|
-
export { setAutoSnapshotOptions, type MetaTask } from './client/auto_snapshot_options.ts';
|
|
7
|
-
export * from './client/expect/expectation_result.ts';
|
|
8
|
-
export type * from './client/expect/to_match_image_snapshot.types.ts';
|
|
9
|
-
export * from './client/task_id.ts';
|
|
10
|
-
export * from './shared/constants.ts';
|
|
11
|
-
export type * from './shared/types.ts';
|
|
12
|
-
//# sourceMappingURL=client-api.d.ts.map
|
package/esm/client-api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-api.d.ts","sourceRoot":"","sources":["../src/client-api.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAA;AAErC,cAAc,+CAA+C,CAAA;AAC7D,cAAc,wDAAwD,CAAA;AACtE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,sDAAsD,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AACzF,cAAc,uCAAuC,CAAA;AACrD,mBAAmB,kDAAkD,CAAA;AACrE,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,mBAAmB,mBAAmB,CAAA"}
|
package/esm/client-api.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "./server/commands/augment.js";
|
|
2
|
-
export * from "./client/actions/has_image_snapshot_action.js";
|
|
3
|
-
export * from "./client/actions/load_image_snapshot_results_action.js";
|
|
4
|
-
export * from "./client/actions/match_image_snapshot_action.js";
|
|
5
|
-
export * from "./client/actions/match_page_image_snapshot_action.js";
|
|
6
|
-
export { setAutoSnapshotOptions } from "./client/auto_snapshot_options.js";
|
|
7
|
-
export * from "./client/expect/expectation_result.js";
|
|
8
|
-
export * from "./client/task_id.js";
|
|
9
|
-
export * from "./shared/constants.js";
|
package/esm/commands.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export * from './server/commands/has_image_snapshot.ts';
|
|
2
|
-
export * from './server/commands/image_snapshot_next_index.ts';
|
|
3
|
-
export * from './server/commands/prepare_image_snapshot_comparison.ts';
|
|
4
|
-
export * from './server/commands/setup_vis_suite.ts';
|
|
5
|
-
//# sourceMappingURL=commands.d.ts.map
|
package/esm/commands.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,wDAAwD,CAAA;AACtE,cAAc,sCAAsC,CAAA"}
|
package/esm/commands.js
DELETED