vitest-plugin-vis 3.5.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asserts--HSSlgPD.mjs +8 -0
- package/dist/asserts--HSSlgPD.mjs.map +1 -0
- package/dist/augment-BJmy1S7i.d.mts +31 -0
- package/dist/augment-BJmy1S7i.d.mts.map +1 -0
- package/dist/auto_snapshot_options-CAD43Zkp.mjs +90 -0
- package/dist/auto_snapshot_options-CAD43Zkp.mjs.map +1 -0
- package/dist/auto_snapshot_options-CaQCXDdi.d.mts +45 -0
- package/dist/auto_snapshot_options-CaQCXDdi.d.mts.map +1 -0
- package/dist/base64-CHSENEAO.mjs +8 -0
- package/dist/base64-CHSENEAO.mjs.map +1 -0
- package/dist/client-api.d.mts +141 -0
- package/dist/client-api.d.mts.map +1 -0
- package/dist/client-api.mjs +14 -0
- package/dist/client-api.mjs.map +1 -0
- package/dist/config.d.mts +28 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +412 -0
- package/dist/config.mjs.map +1 -0
- package/dist/constants-CTBaz8Ml.mjs +10 -0
- package/dist/constants-CTBaz8Ml.mjs.map +1 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +6 -0
- package/dist/presets/auto.d.mts +1 -0
- package/dist/presets/auto.mjs +19 -0
- package/dist/presets/auto.mjs.map +1 -0
- package/dist/presets/enable.d.mts +1 -0
- package/dist/presets/enable.mjs +15 -0
- package/dist/presets/enable.mjs.map +1 -0
- package/dist/presets/manual.d.mts +1 -0
- package/dist/presets/manual.mjs +15 -0
- package/dist/presets/manual.mjs.map +1 -0
- package/dist/server-utils.d.mts +19 -0
- package/dist/server-utils.d.mts.map +1 -0
- package/dist/server-utils.mjs +4 -0
- package/dist/setup-BWgIDtv-.mjs +141 -0
- package/dist/setup-BWgIDtv-.mjs.map +1 -0
- package/dist/setup.d.mts +110 -0
- package/dist/setup.d.mts.map +1 -0
- package/dist/setup.mjs +8 -0
- package/dist/setup_vis_suite-C6JGGT7B.d.mts +17 -0
- package/dist/setup_vis_suite-C6JGGT7B.d.mts.map +1 -0
- package/dist/snapshot_path-7GliOSH_.mjs +58 -0
- package/dist/snapshot_path-7GliOSH_.mjs.map +1 -0
- package/dist/src-CSQnlFa9.mjs +1 -0
- package/dist/task_id-DnS9_4Ub.mjs +316 -0
- package/dist/task_id-DnS9_4Ub.mjs.map +1 -0
- package/dist/testing.d.mts +12 -0
- package/dist/testing.d.mts.map +1 -0
- package/dist/testing.mjs +65550 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/to_match_image_snapshot.types-p-zilA_M.d.mts +9 -0
- package/dist/to_match_image_snapshot.types-p-zilA_M.d.mts.map +1 -0
- package/dist/trim_common_folder-ModiubEJ.d.mts +9 -0
- package/dist/trim_common_folder-ModiubEJ.d.mts.map +1 -0
- package/dist/types-DFb23VE1.d.mts +110 -0
- package/dist/types-DFb23VE1.d.mts.map +1 -0
- package/dist/types-Do1N7g4c.d.mts +63 -0
- package/dist/types-Do1N7g4c.d.mts.map +1 -0
- package/dist/vis_server_context.types-Ce1f9vOO.d.mts +1 -0
- package/package.json +60 -44
- package/readme.md +58 -6
- package/src/client/actions/match_image_snapshot_action.ts +1 -1
- package/src/client/actions/match_page_image_snapshot_action.ts +1 -1
- package/src/client/auto_snapshot_options.ts +16 -1
- package/src/client/compare_image_snapshot.ts +1 -1
- package/src/client/expect/to_match_image_snapshot.ts +1 -1
- package/src/client/page/extend.ts +1 -1
- package/src/client/page/has_image_snapshot.mdx +1 -1
- package/src/client/page/has_image_snapshot.ts +1 -1
- package/src/client/page/to_match_image_snapshot.mdx +1 -1
- package/src/client/page/to_match_image_snapshot.ts +1 -1
- package/src/client/setup/create_vis.ts +16 -14
- package/src/client/setup/vis.ctx.ts +4 -3
- package/src/client/setup/vis.ts +1 -1
- package/src/client/snapshot_meta.ts +5 -0
- package/src/client/vitest_browser_context_proxy.ts +3 -3
- package/src/config/vis.ts +4 -4
- package/src/server/browser_provider/browser_api.ts +2 -2
- package/src/server/browser_provider/playwright.ts +6 -4
- package/src/server/browser_provider/webdriverio.ts +3 -3
- package/src/server/commands/_assertions.ts +3 -3
- package/src/server/commands/augment.ts +1 -1
- package/src/server/commands/has_image_snapshot.ts +2 -2
- package/src/server/commands/image_snapshot_next_index.ts +2 -2
- package/src/server/commands/load_image_snapshot_results.ts +2 -3
- package/src/server/commands/prepare_image_snapshot_comparison.ts +2 -2
- package/src/server/commands/prepare_page_image_snapshot_comparison.ts +2 -2
- package/src/server/commands/setup_vis_suite.ts +3 -3
- package/src/server/project.ts +8 -7
- package/src/server/snapshot.ts +4 -4
- package/src/server/snapshot_path.ts +6 -5
- package/src/server/suite.ts +7 -12
- package/src/server/testing/stubBrowserCommandContext.ts +16 -0
- package/src/{testing → server/testing}/stubSuite.ts +7 -9
- package/src/server/testing/stubUserConfig.ts +6 -0
- package/src/server/vis_options.ts +4 -5
- package/src/server/vis_server_context.logic.ts +7 -7
- package/src/server/vis_server_context.types.ts +31 -26
- package/src/shared/trim_common_folder.ts +1 -0
- package/src/shared/types.ts +2 -0
- package/src/testing.ts +0 -1
- package/esm/client/actions/has_image_snapshot_action.d.ts +0 -4
- package/esm/client/actions/has_image_snapshot_action.d.ts.map +0 -1
- package/esm/client/actions/has_image_snapshot_action.js +0 -6
- package/esm/client/actions/load_image_snapshot_results_action.d.ts +0 -3
- package/esm/client/actions/load_image_snapshot_results_action.d.ts.map +0 -1
- package/esm/client/actions/load_image_snapshot_results_action.js +0 -3
- package/esm/client/actions/match_image_snapshot_action.d.ts +0 -6
- package/esm/client/actions/match_image_snapshot_action.d.ts.map +0 -1
- package/esm/client/actions/match_image_snapshot_action.js +0 -20
- package/esm/client/actions/match_page_image_snapshot_action.d.ts +0 -6
- package/esm/client/actions/match_page_image_snapshot_action.d.ts.map +0 -1
- package/esm/client/actions/match_page_image_snapshot_action.js +0 -9
- package/esm/client/align_images.d.ts +0 -2
- package/esm/client/align_images.d.ts.map +0 -1
- package/esm/client/align_images.js +0 -10
- package/esm/client/auto_snapshot_options.d.ts +0 -29
- package/esm/client/auto_snapshot_options.d.ts.map +0 -1
- package/esm/client/auto_snapshot_options.js +0 -49
- package/esm/client/compare_image_snapshot.d.ts +0 -6
- package/esm/client/compare_image_snapshot.d.ts.map +0 -1
- package/esm/client/compare_image_snapshot.js +0 -52
- package/esm/client/compare_image_snapshot.logic.d.ts +0 -3
- package/esm/client/compare_image_snapshot.logic.d.ts.map +0 -1
- package/esm/client/compare_image_snapshot.logic.js +0 -12
- package/esm/client/ctx.d.ts +0 -7
- package/esm/client/ctx.d.ts.map +0 -1
- package/esm/client/ctx.js +0 -11
- package/esm/client/expect/augment.d.ts +0 -8
- package/esm/client/expect/augment.d.ts.map +0 -1
- package/esm/client/expect/augment.js +0 -1
- package/esm/client/expect/expectation_result.d.ts +0 -3
- package/esm/client/expect/expectation_result.d.ts.map +0 -1
- package/esm/client/expect/expectation_result.js +0 -5
- package/esm/client/expect/extend.d.ts +0 -2
- package/esm/client/expect/extend.d.ts.map +0 -1
- package/esm/client/expect/extend.js +0 -4
- package/esm/client/expect/to_match_image_snapshot.d.ts +0 -9
- package/esm/client/expect/to_match_image_snapshot.d.ts.map +0 -1
- package/esm/client/expect/to_match_image_snapshot.js +0 -21
- package/esm/client/expect/to_match_image_snapshot.types.d.ts +0 -5
- package/esm/client/expect/to_match_image_snapshot.types.d.ts.map +0 -1
- package/esm/client/expect/to_match_image_snapshot.types.js +0 -1
- package/esm/client/image_data.d.ts +0 -3
- package/esm/client/image_data.d.ts.map +0 -1
- package/esm/client/image_data.js +0 -33
- package/esm/client/image_resizer.d.ts +0 -9
- package/esm/client/image_resizer.d.ts.map +0 -1
- package/esm/client/image_resizer.js +0 -49
- package/esm/client/image_snapshot_options.d.ts +0 -2
- package/esm/client/image_snapshot_options.d.ts.map +0 -1
- package/esm/client/image_snapshot_options.js +0 -6
- package/esm/client/page/augment.d.ts +0 -7
- package/esm/client/page/augment.d.ts.map +0 -1
- package/esm/client/page/augment.js +0 -1
- package/esm/client/page/extend.d.ts +0 -2
- package/esm/client/page/extend.d.ts.map +0 -1
- package/esm/client/page/extend.js +0 -5
- package/esm/client/page/has_image_snapshot.d.ts +0 -10
- package/esm/client/page/has_image_snapshot.d.ts.map +0 -1
- package/esm/client/page/has_image_snapshot.js +0 -15
- package/esm/client/page/to_match_image_snapshot.d.ts +0 -6
- package/esm/client/page/to_match_image_snapshot.d.ts.map +0 -1
- package/esm/client/page/to_match_image_snapshot.js +0 -15
- package/esm/client/selector.d.ts +0 -7
- package/esm/client/selector.d.ts.map +0 -1
- package/esm/client/selector.js +0 -97
- package/esm/client/setup/create_vis.d.ts +0 -96
- package/esm/client/setup/create_vis.d.ts.map +0 -1
- package/esm/client/setup/create_vis.js +0 -109
- package/esm/client/setup/vis.ctx.d.ts +0 -12
- package/esm/client/setup/vis.ctx.d.ts.map +0 -1
- package/esm/client/setup/vis.ctx.js +0 -32
- package/esm/client/setup/vis.d.ts +0 -5
- package/esm/client/setup/vis.d.ts.map +0 -1
- package/esm/client/setup/vis.js +0 -6
- package/esm/client/should_take_snapshot.d.ts +0 -3
- package/esm/client/should_take_snapshot.d.ts.map +0 -1
- package/esm/client/should_take_snapshot.js +0 -3
- package/esm/client/snapshot_meta.d.ts +0 -6
- package/esm/client/snapshot_meta.d.ts.map +0 -1
- package/esm/client/snapshot_meta.js +0 -1
- package/esm/client/task_id.d.ts +0 -7
- package/esm/client/task_id.d.ts.map +0 -1
- package/esm/client/task_id.js +0 -10
- package/esm/client/vitest_browser_context_proxy.d.ts +0 -32
- package/esm/client/vitest_browser_context_proxy.d.ts.map +0 -1
- package/esm/client/vitest_browser_context_proxy.js +0 -11
- package/esm/client/vitest_suite_proxy.d.ts +0 -7
- package/esm/client/vitest_suite_proxy.d.ts.map +0 -1
- package/esm/client/vitest_suite_proxy.js +0 -8
- package/esm/client-api.d.ts +0 -12
- package/esm/client-api.d.ts.map +0 -1
- package/esm/client-api.js +0 -9
- package/esm/commands.d.ts +0 -5
- package/esm/commands.d.ts.map +0 -1
- package/esm/commands.js +0 -4
- package/esm/config/types.d.ts +0 -60
- package/esm/config/types.d.ts.map +0 -1
- package/esm/config/types.js +0 -1
- package/esm/config/vis.d.ts +0 -28
- package/esm/config/vis.d.ts.map +0 -1
- package/esm/config/vis.js +0 -27
- package/esm/config.d.ts +0 -4
- package/esm/config.d.ts.map +0 -1
- package/esm/config.js +0 -2
- package/esm/index.d.ts +0 -5
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -4
- package/esm/presets/auto.d.ts +0 -2
- package/esm/presets/auto.d.ts.map +0 -1
- package/esm/presets/auto.js +0 -8
- package/esm/presets/enable.d.ts +0 -2
- package/esm/presets/enable.d.ts.map +0 -1
- package/esm/presets/enable.js +0 -4
- package/esm/presets/manual.d.ts +0 -2
- package/esm/presets/manual.d.ts.map +0 -1
- package/esm/presets/manual.js +0 -4
- package/esm/server/browser_provider/browser_api.d.ts +0 -3
- package/esm/server/browser_provider/browser_api.d.ts.map +0 -1
- package/esm/server/browser_provider/browser_api.js +0 -11
- package/esm/server/browser_provider/playwright.d.ts +0 -4
- package/esm/server/browser_provider/playwright.d.ts.map +0 -1
- package/esm/server/browser_provider/playwright.js +0 -18
- package/esm/server/browser_provider/types.d.ts +0 -10
- package/esm/server/browser_provider/types.d.ts.map +0 -1
- package/esm/server/browser_provider/types.js +0 -1
- package/esm/server/browser_provider/webdriverio.d.ts +0 -4
- package/esm/server/browser_provider/webdriverio.d.ts.map +0 -1
- package/esm/server/browser_provider/webdriverio.js +0 -12
- package/esm/server/commands/_assertions.d.ts +0 -5
- package/esm/server/commands/_assertions.d.ts.map +0 -1
- package/esm/server/commands/_assertions.js +0 -11
- package/esm/server/commands/augment.d.ts +0 -11
- package/esm/server/commands/augment.d.ts.map +0 -1
- package/esm/server/commands/augment.js +0 -1
- package/esm/server/commands/commands.d.ts +0 -9
- package/esm/server/commands/commands.d.ts.map +0 -1
- package/esm/server/commands/commands.js +0 -14
- package/esm/server/commands/has_image_snapshot.d.ts +0 -6
- package/esm/server/commands/has_image_snapshot.d.ts.map +0 -1
- package/esm/server/commands/has_image_snapshot.js +0 -6
- package/esm/server/commands/image_snapshot_next_index.d.ts +0 -9
- package/esm/server/commands/image_snapshot_next_index.d.ts.map +0 -1
- package/esm/server/commands/image_snapshot_next_index.js +0 -6
- package/esm/server/commands/load_image_snapshot_results.d.ts +0 -21
- package/esm/server/commands/load_image_snapshot_results.d.ts.map +0 -1
- package/esm/server/commands/load_image_snapshot_results.js +0 -6
- package/esm/server/commands/prepare_image_snapshot_comparison.d.ts +0 -38
- package/esm/server/commands/prepare_image_snapshot_comparison.d.ts.map +0 -1
- package/esm/server/commands/prepare_image_snapshot_comparison.js +0 -34
- package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts +0 -35
- package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts.map +0 -1
- package/esm/server/commands/prepare_page_image_snapshot_comparison.js +0 -27
- package/esm/server/commands/setup_vis_suite.d.ts +0 -15
- package/esm/server/commands/setup_vis_suite.d.ts.map +0 -1
- package/esm/server/commands/setup_vis_suite.js +0 -6
- package/esm/server/commands/types.d.ts +0 -3
- package/esm/server/commands/types.d.ts.map +0 -1
- package/esm/server/commands/types.js +0 -1
- package/esm/server/externals/file.d.ts +0 -10
- package/esm/server/externals/file.d.ts.map +0 -1
- package/esm/server/externals/file.js +0 -20
- package/esm/server/project.d.ts +0 -21
- package/esm/server/project.d.ts.map +0 -1
- package/esm/server/project.js +0 -13
- package/esm/server/snapshot.d.ts +0 -6
- package/esm/server/snapshot.d.ts.map +0 -1
- package/esm/server/snapshot.js +0 -29
- package/esm/server/snapshot_path.d.ts +0 -14
- package/esm/server/snapshot_path.d.ts.map +0 -1
- package/esm/server/snapshot_path.js +0 -34
- package/esm/server/snapshot_writer.d.ts +0 -13
- package/esm/server/snapshot_writer.d.ts.map +0 -1
- package/esm/server/snapshot_writer.js +0 -15
- package/esm/server/suite.d.ts +0 -54
- package/esm/server/suite.d.ts.map +0 -1
- package/esm/server/suite.js +0 -73
- package/esm/server/vis_options.d.ts +0 -19
- package/esm/server/vis_options.d.ts.map +0 -1
- package/esm/server/vis_options.js +0 -14
- package/esm/server/vis_server_context.d.ts +0 -50
- package/esm/server/vis_server_context.d.ts.map +0 -1
- package/esm/server/vis_server_context.deps.d.ts +0 -29
- package/esm/server/vis_server_context.deps.d.ts.map +0 -1
- package/esm/server/vis_server_context.deps.js +0 -10
- package/esm/server/vis_server_context.js +0 -2
- package/esm/server/vis_server_context.logic.d.ts +0 -53
- package/esm/server/vis_server_context.logic.d.ts.map +0 -1
- package/esm/server/vis_server_context.logic.js +0 -79
- package/esm/server/vis_server_context.types.d.ts +0 -54
- package/esm/server/vis_server_context.types.d.ts.map +0 -1
- package/esm/server/vis_server_context.types.js +0 -1
- package/esm/server-utils.d.ts +0 -4
- package/esm/server-utils.d.ts.map +0 -1
- package/esm/server-utils.js +0 -3
- package/esm/setup.d.ts +0 -5
- package/esm/setup.d.ts.map +0 -1
- package/esm/setup.js +0 -5
- package/esm/shared/asserts.d.ts +0 -2
- package/esm/shared/asserts.d.ts.map +0 -1
- package/esm/shared/asserts.js +0 -5
- package/esm/shared/base64.d.ts +0 -2
- package/esm/shared/base64.d.ts.map +0 -1
- package/esm/shared/base64.js +0 -3
- package/esm/shared/compare_image.d.ts +0 -6
- package/esm/shared/compare_image.d.ts.map +0 -1
- package/esm/shared/compare_image.js +0 -42
- package/esm/shared/constants.d.ts +0 -6
- package/esm/shared/constants.d.ts.map +0 -1
- package/esm/shared/constants.js +0 -5
- package/esm/shared/convert_threshold_unit.d.ts +0 -6
- package/esm/shared/convert_threshold_unit.d.ts.map +0 -1
- package/esm/shared/convert_threshold_unit.js +0 -10
- package/esm/shared/get_max_size.d.ts +0 -11
- package/esm/shared/get_max_size.d.ts.map +0 -1
- package/esm/shared/get_max_size.js +0 -5
- package/esm/shared/is_same_size.d.ts +0 -8
- package/esm/shared/is_same_size.d.ts.map +0 -1
- package/esm/shared/is_same_size.js +0 -3
- package/esm/shared/trim_common_folder.d.ts +0 -6
- package/esm/shared/trim_common_folder.d.ts.map +0 -1
- package/esm/shared/trim_common_folder.js +0 -10
- package/esm/shared/types.d.ts +0 -90
- package/esm/shared/types.d.ts.map +0 -1
- package/esm/shared/types.js +0 -1
- package/esm/testing/constants.d.ts +0 -9
- package/esm/testing/constants.d.ts.map +0 -1
- package/esm/testing/constants.js +0 -1933
- package/esm/testing/stubBrowserCommandContext.d.ts +0 -8
- package/esm/testing/stubBrowserCommandContext.d.ts.map +0 -1
- package/esm/testing/stubBrowserCommandContext.js +0 -12
- package/esm/testing/stubSuite.d.ts +0 -10
- package/esm/testing/stubSuite.d.ts.map +0 -1
- package/esm/testing/stubSuite.js +0 -27
- package/esm/testing/stubUserConfig.d.ts +0 -7
- package/esm/testing/stubUserConfig.d.ts.map +0 -1
- package/esm/testing/stubUserConfig.js +0 -4
- package/esm/testing.d.ts +0 -3
- package/esm/testing.d.ts.map +0 -1
- package/esm/testing.js +0 -2
- package/src/testing/stubBrowserCommandContext.ts +0 -16
- package/src/testing/stubUserConfig.ts +0 -6
package/esm/config/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/config/vis.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ComparisonMethod } from '../shared/types.ts';
|
|
2
|
-
import type { VisOptions } from './types.ts';
|
|
3
|
-
/**
|
|
4
|
-
* Create a Vite plugin for visual testing.
|
|
5
|
-
*
|
|
6
|
-
* If options are not provided, the plugin will use the default options,
|
|
7
|
-
* which enables the `auto` preset.
|
|
8
|
-
*/
|
|
9
|
-
export declare function vis<M extends ComparisonMethod = 'pixel'>(options?: VisOptions<M>): {
|
|
10
|
-
name: string;
|
|
11
|
-
config(this: unknown, userConfig: import("vite").UserConfig): {
|
|
12
|
-
test: {
|
|
13
|
-
browser: {
|
|
14
|
-
name: string;
|
|
15
|
-
commands: {
|
|
16
|
-
setupVisSuite: import("vitest/node").BrowserCommand<[]>;
|
|
17
|
-
imageSnapshotNextIndex: import("vitest/node").BrowserCommand<[taskId: string]>;
|
|
18
|
-
hasImageSnapshot: import("vitest/node").BrowserCommand<[taskId: string, snapshotKey: string | undefined]>;
|
|
19
|
-
preparePageImageSnapshotComparison: import("vitest/node").BrowserCommand<[taskId: string, options?: import("../server/commands/types.ts").MatchImageSnapshotOptions | undefined]>;
|
|
20
|
-
prepareImageSnapshotComparison: import("vitest/node").BrowserCommand<[taskId: string, subject: string, options?: import("../server/commands/types.ts").MatchImageSnapshotOptions | undefined]>;
|
|
21
|
-
loadImageSnapshotResults: import("vitest/node").BrowserCommand<[taskId: string]>;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
setupFiles: string[];
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=vis.d.ts.map
|
package/esm/config/vis.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vis.d.ts","sourceRoot":"","sources":["../../src/config/vis.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,EAAE,OAAO,GAAE,UAAU,CAAC,CAAC,CAA6B;;iBAG7F,OAAO;;;sBAMc,MAAM;;;;;;;;;;;;;EAQzC"}
|
package/esm/config/vis.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { commands } from "../server/commands/commands.js";
|
|
2
|
-
import { setVisOption } from "../server/vis_options.js";
|
|
3
|
-
import { NAME } from "../shared/constants.js";
|
|
4
|
-
/**
|
|
5
|
-
* Create a Vite plugin for visual testing.
|
|
6
|
-
*
|
|
7
|
-
* If options are not provided, the plugin will use the default options,
|
|
8
|
-
* which enables the `auto` preset.
|
|
9
|
-
*/
|
|
10
|
-
export function vis(options = { preset: 'auto' }) {
|
|
11
|
-
return {
|
|
12
|
-
name: NAME,
|
|
13
|
-
config(userConfig) {
|
|
14
|
-
setVisOption(userConfig, options);
|
|
15
|
-
const preset = options?.preset;
|
|
16
|
-
return {
|
|
17
|
-
test: {
|
|
18
|
-
browser: {
|
|
19
|
-
name: undefined,
|
|
20
|
-
commands,
|
|
21
|
-
},
|
|
22
|
-
setupFiles: preset && preset !== 'none' && preset !== 'custom' ? [`vitest-plugin-vis/presets/${preset}`] : [],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
}
|
package/esm/config.d.ts
DELETED
package/esm/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gCAAgC,CAAA"}
|
package/esm/config.js
DELETED
package/esm/index.d.ts
DELETED
package/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,sBAAsB,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AACzF,mBAAmB,mBAAmB,CAAA"}
|
package/esm/index.js
DELETED
package/esm/presets/auto.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../../src/presets/auto.ts"],"names":[],"mappings":""}
|
package/esm/presets/auto.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeAll } from 'vitest';
|
|
2
|
-
import { setAutoSnapshotOptions } from "../index.js";
|
|
3
|
-
import { vis } from "../setup.js";
|
|
4
|
-
beforeAll(async () => {
|
|
5
|
-
await vis.beforeAll.setup();
|
|
6
|
-
setAutoSnapshotOptions(true);
|
|
7
|
-
});
|
|
8
|
-
afterEach(() => vis.afterEach.matchImageSnapshot());
|
package/esm/presets/enable.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enable.d.ts","sourceRoot":"","sources":["../../src/presets/enable.ts"],"names":[],"mappings":""}
|
package/esm/presets/enable.js
DELETED
package/esm/presets/manual.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manual.d.ts","sourceRoot":"","sources":["../../src/presets/manual.ts"],"names":[],"mappings":""}
|
package/esm/presets/manual.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser_api.d.ts","sourceRoot":"","sources":["../../../src/server/browser_provider/browser_api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAIxD,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,mCAQxD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { playwright } from "./playwright.js";
|
|
2
|
-
import { webdriverio } from "./webdriverio.js";
|
|
3
|
-
export function browserApi(context) {
|
|
4
|
-
if (context.provider.name === 'playwright') {
|
|
5
|
-
return playwright(context);
|
|
6
|
-
}
|
|
7
|
-
if (context.provider.name === 'webdriverio') {
|
|
8
|
-
return webdriverio(context);
|
|
9
|
-
}
|
|
10
|
-
throw new Error(`Unsupported provider: ${context.provider.name}`);
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.d.ts","sourceRoot":"","sources":["../../../src/server/browser_provider/playwright.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAgBrE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'pathe';
|
|
2
|
-
export function playwright(context) {
|
|
3
|
-
return {
|
|
4
|
-
async takeScreenshot(projectRoot, relativeFilePath, selector, options) {
|
|
5
|
-
const subject = context.iframe.locator(selector);
|
|
6
|
-
return subject.screenshot({
|
|
7
|
-
path: resolve(projectRoot, relativeFilePath),
|
|
8
|
-
...options,
|
|
9
|
-
});
|
|
10
|
-
},
|
|
11
|
-
async takePageScreenshot(projectRoot, relativeFilePath, options) {
|
|
12
|
-
return context.page.screenshot({
|
|
13
|
-
path: resolve(projectRoot, relativeFilePath),
|
|
14
|
-
...options,
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface BrowserApi {
|
|
2
|
-
takeScreenshot(projectRoot: string, relativeFilePath: string, selector: string, options: {
|
|
3
|
-
timeout?: number | undefined;
|
|
4
|
-
} | undefined): Promise<Buffer>;
|
|
5
|
-
takePageScreenshot(projectRoot: string, relativeFilePath: string, options: {
|
|
6
|
-
fullPage?: boolean | undefined;
|
|
7
|
-
timeout?: number | undefined;
|
|
8
|
-
} | undefined): Promise<Buffer>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/browser_provider/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IAC1B,cAAc,CACb,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,EAChB,OAAO,EACJ;QACA,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC3B,GACD,SAAS,GACV,OAAO,CAAC,MAAM,CAAC,CAAA;IAClB,kBAAkB,CACjB,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EACJ;QACA,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAC3B,GACD,SAAS,GACV,OAAO,CAAC,MAAM,CAAC,CAAA;CAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webdriverio.d.ts","sourceRoot":"","sources":["../../../src/server/browser_provider/webdriverio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,wBAAgB,WAAW,CAAC,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAWtE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function webdriverio(context) {
|
|
2
|
-
const browser = context.browser;
|
|
3
|
-
return {
|
|
4
|
-
async takeScreenshot(_projectRoot, relativeFilePath, selector) {
|
|
5
|
-
const element = await browser.$(`${selector}`);
|
|
6
|
-
return element.saveScreenshot(relativeFilePath);
|
|
7
|
-
},
|
|
8
|
-
async takePageScreenshot(_projectRoot, relativeFilePath, options) {
|
|
9
|
-
return browser.saveScreenshot(relativeFilePath, options);
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { RequiredPick } from 'type-plus';
|
|
2
|
-
import type { BrowserCommandContext } from 'vitest/node';
|
|
3
|
-
export declare function assertTestPathDefined(context: BrowserCommandContext, commandName: string): asserts context is RequiredPick<BrowserCommandContext, 'testPath'>;
|
|
4
|
-
export declare function assertIsRelativePath(relativeFilePath: string, propName: string): void;
|
|
5
|
-
//# sourceMappingURL=_assertions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_assertions.d.ts","sourceRoot":"","sources":["../../../src/server/commands/_assertions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAIpE;AAED,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAI9E"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isAbsolute } from 'pathe';
|
|
2
|
-
export function assertTestPathDefined(context, commandName) {
|
|
3
|
-
if (!context.testPath) {
|
|
4
|
-
throw new Error(`'commands.${commandName}' requires testPath to be defined`);
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export function assertIsRelativePath(relativeFilePath, propName) {
|
|
8
|
-
if (isAbsolute(relativeFilePath)) {
|
|
9
|
-
throw new Error(`'${propName}' must be a relative path`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { HasImageSnapshotCommand } from './has_image_snapshot.ts';
|
|
2
|
-
import type { ImageSnapshotNextIndexCommand } from './image_snapshot_next_index.ts';
|
|
3
|
-
import type { LoadImageSnapshotResultsCommand } from './load_image_snapshot_results.ts';
|
|
4
|
-
import type { PrepareImageSnapshotComparisonCommand } from './prepare_image_snapshot_comparison.ts';
|
|
5
|
-
import type { PreparePageImageSnapshotComparisonCommand } from './prepare_page_image_snapshot_comparison.ts';
|
|
6
|
-
import type { SetupVisSuiteCommand } from './setup_vis_suite.ts';
|
|
7
|
-
declare module '@vitest/browser/context' {
|
|
8
|
-
interface BrowserCommands extends SetupVisSuiteCommand, ImageSnapshotNextIndexCommand, HasImageSnapshotCommand, PreparePageImageSnapshotComparisonCommand, PrepareImageSnapshotComparisonCommand, LoadImageSnapshotResultsCommand {
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=augment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"augment.d.ts","sourceRoot":"","sources":["../../../src/server/commands/augment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAA;AACnF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAA;AACvF,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,wCAAwC,CAAA;AACnG,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAA;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,QAAQ,yBAAyB,CAAC;IACxC,UAAU,eACT,SAAQ,oBAAoB,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,yCAAyC,EACzC,qCAAqC,EACrC,+BAA+B;KAAG;CACpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const commands: {
|
|
2
|
-
setupVisSuite: import("vitest/node").BrowserCommand<[]>;
|
|
3
|
-
imageSnapshotNextIndex: import("vitest/node").BrowserCommand<[taskId: string]>;
|
|
4
|
-
hasImageSnapshot: import("vitest/node").BrowserCommand<[taskId: string, snapshotKey: string | undefined]>;
|
|
5
|
-
preparePageImageSnapshotComparison: import("vitest/node").BrowserCommand<[taskId: string, options?: import("./types.ts").MatchImageSnapshotOptions | undefined]>;
|
|
6
|
-
prepareImageSnapshotComparison: import("vitest/node").BrowserCommand<[taskId: string, subject: string, options?: import("./types.ts").MatchImageSnapshotOptions | undefined]>;
|
|
7
|
-
loadImageSnapshotResults: import("vitest/node").BrowserCommand<[taskId: string]>;
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/server/commands/commands.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ;;;;;;;CAOpB,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { hasImageSnapshot } from "./has_image_snapshot.js";
|
|
2
|
-
import { imageSnapshotNextIndex } from "./image_snapshot_next_index.js";
|
|
3
|
-
import { loadImageSnapshotResults } from "./load_image_snapshot_results.js";
|
|
4
|
-
import { prepareImageSnapshotComparison } from "./prepare_image_snapshot_comparison.js";
|
|
5
|
-
import { preparePageImageSnapshotComparison } from "./prepare_page_image_snapshot_comparison.js";
|
|
6
|
-
import { setupVisSuite } from "./setup_vis_suite.js";
|
|
7
|
-
export const commands = {
|
|
8
|
-
setupVisSuite,
|
|
9
|
-
imageSnapshotNextIndex,
|
|
10
|
-
hasImageSnapshot,
|
|
11
|
-
preparePageImageSnapshotComparison,
|
|
12
|
-
prepareImageSnapshotComparison,
|
|
13
|
-
loadImageSnapshotResults,
|
|
14
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
2
|
-
export interface HasImageSnapshotCommand {
|
|
3
|
-
hasImageSnapshot(taskId: string, snapshotKey: string | undefined): Promise<boolean>;
|
|
4
|
-
}
|
|
5
|
-
export declare const hasImageSnapshot: BrowserCommand<Parameters<HasImageSnapshotCommand['hasImageSnapshot']>>;
|
|
6
|
-
//# sourceMappingURL=has_image_snapshot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has_image_snapshot.d.ts","sourceRoot":"","sources":["../../../src/server/commands/has_image_snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,MAAM,WAAW,uBAAuB;IACvC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACnF;AAED,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,UAAU,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,CAQpG,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { visServerContext } from "../vis_server_context.js";
|
|
2
|
-
import { assertTestPathDefined } from "./_assertions.js";
|
|
3
|
-
export const hasImageSnapshot = async (context, taskId, snapshotKey) => {
|
|
4
|
-
assertTestPathDefined(context, 'hasImageSnapshot');
|
|
5
|
-
return visServerContext.hasImageSnapshot(context, taskId, snapshotKey);
|
|
6
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
2
|
-
export interface ImageSnapshotNextIndexCommand {
|
|
3
|
-
/**
|
|
4
|
-
* Get the index of the snapshot image to be created.
|
|
5
|
-
*/
|
|
6
|
-
imageSnapshotNextIndex(taskId: string): Promise<number>;
|
|
7
|
-
}
|
|
8
|
-
export declare const imageSnapshotNextIndex: BrowserCommand<Parameters<ImageSnapshotNextIndexCommand['imageSnapshotNextIndex']>>;
|
|
9
|
-
//# sourceMappingURL=image_snapshot_next_index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image_snapshot_next_index.d.ts","sourceRoot":"","sources":["../../../src/server/commands/image_snapshot_next_index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACvD;AAED,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAClD,UAAU,CAAC,6BAA6B,CAAC,wBAAwB,CAAC,CAAC,CAKnE,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { visServerContext } from "../vis_server_context.js";
|
|
2
|
-
import { assertTestPathDefined } from "./_assertions.js";
|
|
3
|
-
export const imageSnapshotNextIndex = async (context, taskId) => {
|
|
4
|
-
assertTestPathDefined(context, 'imageSnapshotNextIndex');
|
|
5
|
-
return visServerContext.getTaskCount(context, taskId);
|
|
6
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
2
|
-
export interface ImageSnapshotResult {
|
|
3
|
-
filename: string;
|
|
4
|
-
/**
|
|
5
|
-
* The base64 encoded image of the baseline snapshot.
|
|
6
|
-
*/
|
|
7
|
-
baseline?: string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* The base64 encoded image of the result snapshot.
|
|
10
|
-
*/
|
|
11
|
-
result?: string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* The base64 encoded image of the diff snapshot.
|
|
14
|
-
*/
|
|
15
|
-
diff?: string | undefined;
|
|
16
|
-
}
|
|
17
|
-
export interface LoadImageSnapshotResultsCommand {
|
|
18
|
-
loadImageSnapshotResults(taskId: string): Promise<ImageSnapshotResult[]>;
|
|
19
|
-
}
|
|
20
|
-
export declare const loadImageSnapshotResults: BrowserCommand<[taskId: string]>;
|
|
21
|
-
//# sourceMappingURL=load_image_snapshot_results.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load_image_snapshot_results.d.ts","sourceRoot":"","sources":["../../../src/server/commands/load_image_snapshot_results.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB;AAED,MAAM,WAAW,+BAA+B;IAC/C,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;CACxE;AAED,eAAO,MAAM,wBAAwB,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAOrE,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { visServerContext } from "../vis_server_context.js";
|
|
2
|
-
import { assertTestPathDefined } from "./_assertions.js";
|
|
3
|
-
export const loadImageSnapshotResults = async (context, taskId) => {
|
|
4
|
-
assertTestPathDefined(context, 'loadImageSnapshotResults');
|
|
5
|
-
return visServerContext.getSnapshotResults(context, taskId);
|
|
6
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
2
|
-
import type { FailureThresholdOptions, ImageSnapshotTimeoutOptions, PixelComparisonOptions, SsimComparisonOptions } from '../../shared/types.ts';
|
|
3
|
-
import type { MatchImageSnapshotOptions } from './types.ts';
|
|
4
|
-
export type ImageSnapshotComparisonInfo = {
|
|
5
|
-
/**
|
|
6
|
-
* Path to the project root.
|
|
7
|
-
*/
|
|
8
|
-
projectRoot: string;
|
|
9
|
-
/**
|
|
10
|
-
* Path to the baseline image relative to the project root.
|
|
11
|
-
*/
|
|
12
|
-
baselinePath: string;
|
|
13
|
-
/**
|
|
14
|
-
* Path to the result image relative to the project root.
|
|
15
|
-
*/
|
|
16
|
-
resultPath: string;
|
|
17
|
-
/**
|
|
18
|
-
* Path to the diff image relative to the project root.
|
|
19
|
-
*/
|
|
20
|
-
diffPath: string;
|
|
21
|
-
/**
|
|
22
|
-
* Base64 encoded baseline image.
|
|
23
|
-
*/
|
|
24
|
-
baseline: string;
|
|
25
|
-
/**
|
|
26
|
-
* Base64 encoded result image.
|
|
27
|
-
*/
|
|
28
|
-
result: string;
|
|
29
|
-
/**
|
|
30
|
-
* Base64 encoded diff image.
|
|
31
|
-
*/
|
|
32
|
-
diff?: string | undefined;
|
|
33
|
-
} & ImageSnapshotTimeoutOptions & FailureThresholdOptions & (SsimComparisonOptions | PixelComparisonOptions);
|
|
34
|
-
export interface PrepareImageSnapshotComparisonCommand {
|
|
35
|
-
prepareImageSnapshotComparison: (taskId: string, subject: string, options?: MatchImageSnapshotOptions | undefined) => Promise<ImageSnapshotComparisonInfo | undefined>;
|
|
36
|
-
}
|
|
37
|
-
export declare const prepareImageSnapshotComparison: BrowserCommand<Parameters<PrepareImageSnapshotComparisonCommand['prepareImageSnapshotComparison']>>;
|
|
38
|
-
//# sourceMappingURL=prepare_image_snapshot_comparison.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepare_image_snapshot_comparison.d.ts","sourceRoot":"","sources":["../../../src/server/commands/prepare_image_snapshot_comparison.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,KAAK,EACX,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,uBAAuB,CAAA;AAO9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,MAAM,MAAM,2BAA2B,GAAG;IACzC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,GAAG,2BAA2B,GAC9B,uBAAuB,GACvB,CAAC,qBAAqB,GAAG,sBAAsB,CAAC,CAAA;AAEjD,MAAM,WAAW,qCAAqC;IACrD,8BAA8B,EAAE,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,yBAAyB,GAAG,SAAS,KAC3C,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAC1D,UAAU,CAAC,qCAAqC,CAAC,gCAAgC,CAAC,CAAC,CA2BnF,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'pathe';
|
|
2
|
-
import { isBase64String } from "../../shared/base64.js";
|
|
3
|
-
import { file } from "../externals/file.js";
|
|
4
|
-
import { getProjectRoot } from "../project.js";
|
|
5
|
-
import { takeSnapshot, takeSnapshotByBrowser } from "../snapshot.js";
|
|
6
|
-
import { snapshotWriter } from "../snapshot_writer.js";
|
|
7
|
-
import { visServerContext } from "../vis_server_context.js";
|
|
8
|
-
import { assertTestPathDefined } from "./_assertions.js";
|
|
9
|
-
export const prepareImageSnapshotComparison = async (context, taskId, subject, options) => {
|
|
10
|
-
assertTestPathDefined(context, 'prepareImageSnapshotComparison');
|
|
11
|
-
// vitest:browser passes in `null` when not defined
|
|
12
|
-
if (!options)
|
|
13
|
-
options = {};
|
|
14
|
-
options.timeout = options.timeout ?? 30000;
|
|
15
|
-
const projectRoot = getProjectRoot(context);
|
|
16
|
-
const info = await visServerContext.getSnapshotInfo(context, taskId, options);
|
|
17
|
-
const baselineBuffer = await file.tryReadFile(resolve(projectRoot, info.baselinePath));
|
|
18
|
-
if (!baselineBuffer) {
|
|
19
|
-
if (isBase64String(subject)) {
|
|
20
|
-
await snapshotWriter.writeBase64(resolve(projectRoot, info.baselinePath), subject);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
await takeSnapshotByBrowser(context, projectRoot, info.baselinePath, subject, options);
|
|
24
|
-
}
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const resultBuffer = await takeSnapshot(context, projectRoot, info.resultPath, subject, options);
|
|
28
|
-
return {
|
|
29
|
-
...info,
|
|
30
|
-
projectRoot,
|
|
31
|
-
baseline: baselineBuffer.toString('base64'),
|
|
32
|
-
result: resultBuffer.toString('base64'),
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
2
|
-
import type { FailureThresholdOptions, ImageSnapshotTimeoutOptions, PixelComparisonOptions, SsimComparisonOptions } from '../../shared/types.ts';
|
|
3
|
-
import type { MatchImageSnapshotOptions } from './types.ts';
|
|
4
|
-
type ImageSnapshotComparisonInfo = {
|
|
5
|
-
/**
|
|
6
|
-
* Path to the project root.
|
|
7
|
-
*/
|
|
8
|
-
projectRoot: string;
|
|
9
|
-
/**
|
|
10
|
-
* Path to the baseline image relative to the project root.
|
|
11
|
-
*/
|
|
12
|
-
baselinePath: string;
|
|
13
|
-
/**
|
|
14
|
-
* Path to the result image relative to the project root.
|
|
15
|
-
*/
|
|
16
|
-
resultPath: string;
|
|
17
|
-
/**
|
|
18
|
-
* Path to the diff image relative to the project root.
|
|
19
|
-
*/
|
|
20
|
-
diffPath: string;
|
|
21
|
-
/**
|
|
22
|
-
* Base64 encoded baseline image.
|
|
23
|
-
*/
|
|
24
|
-
baseline: string;
|
|
25
|
-
/**
|
|
26
|
-
* Base64 encoded result image.
|
|
27
|
-
*/
|
|
28
|
-
result: string;
|
|
29
|
-
} & ImageSnapshotTimeoutOptions & FailureThresholdOptions & (SsimComparisonOptions | PixelComparisonOptions);
|
|
30
|
-
export interface PreparePageImageSnapshotComparisonCommand {
|
|
31
|
-
preparePageImageSnapshotComparison: (taskId: string, options?: MatchImageSnapshotOptions | undefined) => Promise<ImageSnapshotComparisonInfo | undefined>;
|
|
32
|
-
}
|
|
33
|
-
export declare const preparePageImageSnapshotComparison: BrowserCommand<Parameters<PreparePageImageSnapshotComparisonCommand['preparePageImageSnapshotComparison']>>;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=prepare_page_image_snapshot_comparison.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepare_page_image_snapshot_comparison.d.ts","sourceRoot":"","sources":["../../../src/server/commands/prepare_page_image_snapshot_comparison.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EACX,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,uBAAuB,CAAA;AAM9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,KAAK,2BAA2B,GAAG;IAClC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACd,GAAG,2BAA2B,GAC9B,uBAAuB,GACvB,CAAC,qBAAqB,GAAG,sBAAsB,CAAC,CAAA;AAEjD,MAAM,WAAW,yCAAyC;IACzD,kCAAkC,EAAE,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,yBAAyB,GAAG,SAAS,KAC3C,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,kCAAkC,EAAE,cAAc,CAC9D,UAAU,CAAC,yCAAyC,CAAC,oCAAoC,CAAC,CAAC,CAsB3F,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'pathe';
|
|
2
|
-
import { file } from "../externals/file.js";
|
|
3
|
-
import { getProjectRoot } from "../project.js";
|
|
4
|
-
import { takePageSnapshot } from "../snapshot.js";
|
|
5
|
-
import { visServerContext } from "../vis_server_context.js";
|
|
6
|
-
import { assertTestPathDefined } from "./_assertions.js";
|
|
7
|
-
export const preparePageImageSnapshotComparison = async (context, taskId, options) => {
|
|
8
|
-
assertTestPathDefined(context, 'preparePageImageSnapshotComparison');
|
|
9
|
-
// vitest:browser passes in `null` when not defined
|
|
10
|
-
if (!options)
|
|
11
|
-
options = {};
|
|
12
|
-
options.timeout = options.timeout ?? 30000;
|
|
13
|
-
const projectRoot = getProjectRoot(context);
|
|
14
|
-
const info = await visServerContext.getSnapshotInfo(context, taskId, options);
|
|
15
|
-
const baselineBuffer = await file.tryReadFile(resolve(projectRoot, info.baselinePath));
|
|
16
|
-
if (!baselineBuffer) {
|
|
17
|
-
await takePageSnapshot(context, projectRoot, info.baselinePath, options);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const resultBuffer = await takePageSnapshot(context, projectRoot, info.resultPath, options);
|
|
21
|
-
return {
|
|
22
|
-
...info,
|
|
23
|
-
projectRoot,
|
|
24
|
-
baseline: baselineBuffer.toString('base64'),
|
|
25
|
-
result: resultBuffer.toString('base64'),
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Pick } from 'type-plus';
|
|
2
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
3
|
-
import type { VisOptions } from '../../config/types.ts';
|
|
4
|
-
export interface SetupVisSuiteCommand {
|
|
5
|
-
/**
|
|
6
|
-
* Sets up the visual testing suite by cleaning up previous snapshot and diff output directories.
|
|
7
|
-
* When this command is run for the first time,
|
|
8
|
-
* it will remove the results and diffs directory of all suites.
|
|
9
|
-
*
|
|
10
|
-
* In subsequent runs, it will only remove the results and diffs directory of the current suite.
|
|
11
|
-
*/
|
|
12
|
-
setupVisSuite: () => Promise<Pick<VisOptions, 'comparisonMethod' | 'diffOptions' | 'failureThreshold' | 'failureThresholdType' | 'snapshotKey' | 'subject' | 'timeout'>>;
|
|
13
|
-
}
|
|
14
|
-
export declare const setupVisSuite: BrowserCommand<[]>;
|
|
15
|
-
//# sourceMappingURL=setup_vis_suite.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup_vis_suite.d.ts","sourceRoot":"","sources":["../../../src/server/commands/setup_vis_suite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAIvD,MAAM,WAAW,oBAAoB;IACpC;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,OAAO,CAC3B,IAAI,CACH,UAAU,EACR,kBAAkB,GAClB,aAAa,GACb,kBAAkB,GAClB,sBAAsB,GACtB,aAAa,GACb,SAAS,GACT,SAAS,CACX,CACD,CAAA;CACD;AAED,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,EAAE,CAG5C,CAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ImageSnapshotCompareOptions, ImageSnapshotKeyOptions, ImageSnapshotTimeoutOptions } from '../../shared/types.ts';
|
|
2
|
-
export type MatchImageSnapshotOptions = ImageSnapshotTimeoutOptions & ImageSnapshotCompareOptions<any> & ImageSnapshotKeyOptions;
|
|
3
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC3B,MAAM,uBAAuB,CAAA;AAE9B,MAAM,MAAM,yBAAyB,GAAG,2BAA2B,GAClE,2BAA2B,CAAC,GAAG,CAAC,GAChC,uBAAuB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type GlobOptionsWithFileTypesUnset } from 'glob';
|
|
2
|
-
import { writeFile } from 'node:fs/promises';
|
|
3
|
-
export declare const file: {
|
|
4
|
-
existFile(filePath: string): Promise<boolean>;
|
|
5
|
-
glob(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined): Promise<string[]>;
|
|
6
|
-
mkdirp: (path: string) => Promise<string | undefined>;
|
|
7
|
-
tryReadFile(filePath: string | undefined): Promise<Buffer | undefined>;
|
|
8
|
-
writeFile: typeof writeFile;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/server/externals/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,6BAA6B,EAAE,MAAM,MAAM,CAAA;AAE/D,OAAO,EAAkB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5D,eAAO,MAAM,IAAI;wBACI,MAAM;kBAKZ,MAAM,GAAG,MAAM,EAAE,YAAY,6BAA6B,GAAG,SAAS;YAGlE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;0BACnC,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;CAM5E,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { glob } from 'glob';
|
|
2
|
-
import { mkdirp } from 'mkdirp';
|
|
3
|
-
import { readFile, stat, writeFile } from 'node:fs/promises';
|
|
4
|
-
export const file = {
|
|
5
|
-
existFile(filePath) {
|
|
6
|
-
return stat(filePath)
|
|
7
|
-
.then((s) => s.isFile())
|
|
8
|
-
.catch(() => false);
|
|
9
|
-
},
|
|
10
|
-
glob(pattern, options) {
|
|
11
|
-
return glob(pattern, options);
|
|
12
|
-
},
|
|
13
|
-
mkdirp: mkdirp,
|
|
14
|
-
async tryReadFile(filePath) {
|
|
15
|
-
if (!filePath)
|
|
16
|
-
return undefined;
|
|
17
|
-
return readFile(filePath).catch(() => undefined);
|
|
18
|
-
},
|
|
19
|
-
writeFile,
|
|
20
|
-
};
|