vitest-plugin-vis 4.2.1 → 5.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/client/expect/augment.d.mts.map +1 -1
- package/dist/client/external/vitest/vitest_browser_context_proxy.mjs.map +1 -1
- package/dist/client/external/vitest/vitest_suite_proxy.d.mts +1 -2
- package/dist/client/external/vitest/vitest_suite_proxy.mjs +5 -5
- package/dist/client/external/vitest/vitest_suite_proxy.mjs.map +1 -1
- package/dist/client/page/_ctx.d.mts +1 -1
- package/dist/client/page/_ctx.mjs.map +1 -1
- package/dist/config/types.d.mts +1 -3
- package/dist/config/vis.mjs +1 -1
- package/dist/config/vis.mjs.map +1 -1
- package/dist/presets/auto.mjs +1 -8
- package/dist/presets/auto.mjs.map +1 -1
- package/dist/presets/manual.mjs +1 -3
- package/dist/presets/manual.mjs.map +1 -1
- package/dist/server/vis_server_context.types.d.mts +1 -2
- package/dist/setup/create_vis.d.mts +1 -66
- package/dist/setup/create_vis.d.mts.map +1 -1
- package/dist/setup/create_vis.mjs +9 -45
- package/dist/setup/create_vis.mjs.map +1 -1
- package/dist/setup.d.mts +1 -11
- package/dist/setup.mjs +1 -10
- package/package.json +17 -22
- package/readme.md +4 -4
- package/src/client/expect/augment.ts +0 -1
- package/src/client/external/vitest/vitest_browser_context_proxy.ts +2 -2
- package/src/client/external/vitest/vitest_suite_proxy.ts +6 -6
- package/src/client/page/_ctx.ts +2 -2
- package/src/config/types.ts +1 -3
- package/src/config/vis.ts +1 -1
- package/src/presets/auto.ts +1 -7
- package/src/presets/manual.ts +1 -3
- package/src/setup/create_vis.mdx +2 -6
- package/src/setup/create_vis.ts +1 -112
- package/src/setup.ts +0 -7
- package/dist/presets/enable.d.mts +0 -1
- package/dist/presets/enable.mjs +0 -11
- package/dist/presets/enable.mjs.map +0 -1
- package/dist/setup.d.mts.map +0 -1
- package/dist/setup.mjs.map +0 -1
- package/src/presets/enable.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment.d.mts","names":[],"sources":["../../../src/client/expect/augment.ts"],"sourcesContent":[],"mappings":";;;;;IAA8E,UAAA,QAAA,CAAA,CAAA,EAAA,CAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"augment.d.mts","names":[],"sources":["../../../src/client/expect/augment.ts"],"sourcesContent":[],"mappings":";;;;;IAA8E,UAAA,QAAA,CAAA,CAAA,EAAA,CAAA,CAAA,SAI3C,oBAJ2C,CAAA,CAAA;EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest_browser_context_proxy.mjs","names":[],"sources":["../../../../src/client/external/vitest/vitest_browser_context_proxy.ts"],"sourcesContent":["import type { SerializedConfig } from 'vitest'\nimport type { BrowserCommands
|
|
1
|
+
{"version":3,"file":"vitest_browser_context_proxy.mjs","names":[],"sources":["../../../../src/client/external/vitest/vitest_browser_context_proxy.ts"],"sourcesContent":["import type { SerializedConfig } from 'vitest'\nimport type { BrowserCommands } from 'vitest/browser'\n\nlet ctx: Awaited<typeof import('vitest/browser')>\n\nif ((globalThis as any).__vitest_browser__) {\n\timport('vitest/browser').then((m) => {\n\t\tctx = m\n\t})\n}\n\nexport const server = new Proxy<{\n\t/**\n\t * Platform the Vitest server is running on.\n\t * The same as calling `process.platform` on the server.\n\t */\n\tplatform: string\n\t/**\n\t * Runtime version of the Vitest server.\n\t * The same as calling `process.version` on the server.\n\t */\n\tversion: string\n\t/**\n\t * Name of the browser provider.\n\t */\n\tprovider: string\n\t/**\n\t * Name of the current browser.\n\t */\n\tbrowser: string\n\t/**\n\t * Available commands for the browser.\n\t * @see {@link https://vitest.dev/guide/browser/commands}\n\t */\n\tcommands: BrowserCommands\n\t/**\n\t * Serialized test config.\n\t */\n\tconfig: SerializedConfig\n}>({} as any, {\n\tget(target, prop) {\n\t\treturn (target as any)[prop] ?? (ctx?.server as any)[prop]\n\t},\n})\n"],"mappings":";AAGA,IAAI;AAEJ,IAAK,WAAmB,mBACvB,QAAO,kBAAkB,MAAM,MAAM;AACpC,OAAM;EACL;AAGH,MAAa,SAAS,IAAI,MA4BvB,EAAE,EAAS,EACb,IAAI,QAAQ,MAAM;AACjB,QAAQ,OAAe,UAAU,KAAK,QAAe;GAEtD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
//#region src/client/external/vitest/vitest_suite_proxy.ts
|
|
2
|
-
let
|
|
3
|
-
if (globalThis.__vitest_browser__) import("vitest
|
|
4
|
-
|
|
2
|
+
let vitest;
|
|
3
|
+
if (globalThis.__vitest_browser__) import("vitest").then((m) => {
|
|
4
|
+
vitest = m;
|
|
5
5
|
});
|
|
6
|
-
const getCurrentTest = () =>
|
|
7
|
-
const getCurrentSuite = () =>
|
|
6
|
+
const getCurrentTest = () => vitest?.TestRunner.getCurrentTest();
|
|
7
|
+
const getCurrentSuite = () => vitest?.TestRunner.getCurrentSuite();
|
|
8
8
|
|
|
9
9
|
//#endregion
|
|
10
10
|
export { getCurrentSuite, getCurrentTest };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest_suite_proxy.mjs","names":[],"sources":["../../../../src/client/external/vitest/vitest_suite_proxy.ts"],"sourcesContent":["import type { SnapshotTestMeta } from '../../../shared/types.ts'\n\nlet
|
|
1
|
+
{"version":3,"file":"vitest_suite_proxy.mjs","names":[],"sources":["../../../../src/client/external/vitest/vitest_suite_proxy.ts"],"sourcesContent":["import type { SnapshotTestMeta } from '../../../shared/types.ts'\n\nlet vitest: Awaited<typeof import('vitest')>\n\nif ((globalThis as any).__vitest_browser__) {\n\timport('vitest').then((m) => {\n\t\tvitest = m\n\t})\n}\n\nexport type CurrentTest = ReturnType<typeof vitest.TestRunner.getCurrentTest> & SnapshotTestMeta\n\nexport const getCurrentTest = () => vitest?.TestRunner.getCurrentTest() as CurrentTest\nexport const getCurrentSuite = () => vitest?.TestRunner.getCurrentSuite()\n"],"mappings":";AAEA,IAAI;AAEJ,IAAK,WAAmB,mBACvB,QAAO,UAAU,MAAM,MAAM;AAC5B,UAAS;EACR;AAKH,MAAa,uBAAuB,QAAQ,WAAW,gBAAgB;AACvE,MAAa,wBAAwB,QAAQ,WAAW,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_ctx.mjs","names":[],"sources":["../../../src/client/page/_ctx.ts"],"sourcesContent":["import { type
|
|
1
|
+
{"version":3,"file":"_ctx.mjs","names":[],"sources":["../../../src/client/page/_ctx.ts"],"sourcesContent":["import { commands, type BrowserCommands, type BrowserPage } from 'vitest/browser'\nimport { getCurrentTest } from '../external/vitest/vitest_suite_proxy.ts'\n\nexport type { BrowserPage }\n\nexport const ctx = {\n\tcommands: commands as BrowserCommands,\n\tgetCurrentTest,\n\t__test__reset() {\n\t\tctx.getCurrentTest = getCurrentTest\n\t},\n}\n"],"mappings":";;;;AAKA,MAAa,MAAM;CACR;CACV;CACA,gBAAgB;AACf,MAAI,iBAAiB;;CAEtB"}
|
package/dist/config/types.d.mts
CHANGED
|
@@ -18,10 +18,8 @@ type VisOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim' ? {
|
|
|
18
18
|
* Loads the `test.setupFiles` of the specified preset.
|
|
19
19
|
*
|
|
20
20
|
* @default 'auto'
|
|
21
|
-
* @deprecated 'enable' is deprecated. Use `manual` for the same effect.
|
|
22
|
-
* @deprecated 'none' is deprecated. Use `custom` for the same effect.
|
|
23
21
|
*/
|
|
24
|
-
preset?: '
|
|
22
|
+
preset?: 'manual' | 'auto' | 'custom' | undefined;
|
|
25
23
|
/**
|
|
26
24
|
* The snapshot folder relative to the root of the project.
|
|
27
25
|
*
|
package/dist/config/vis.mjs
CHANGED
|
@@ -20,7 +20,7 @@ function vis(options = { preset: "auto" }) {
|
|
|
20
20
|
name: void 0,
|
|
21
21
|
commands
|
|
22
22
|
},
|
|
23
|
-
setupFiles: preset && preset !== "
|
|
23
|
+
setupFiles: preset && preset !== "custom" ? [`vitest-plugin-vis/presets/${preset}`] : []
|
|
24
24
|
} };
|
|
25
25
|
}
|
|
26
26
|
};
|
package/dist/config/vis.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vis.mjs","names":[],"sources":["../../src/config/vis.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config'\nimport { commands } from '../server/commands/commands.ts'\nimport { setVisOption } from '../server/vis_options.ts'\nimport { NAME } from '../shared/constants.ts'\nimport type { ComparisonMethod } from '../shared/types.ts'\nimport type { VisOptions } from './types.ts'\n\n/**\n * Create a Vite plugin for visual testing.\n *\n * If options are not provided, the plugin will use the default options,\n * which enables the `auto` preset.\n */\nexport function vis<M extends ComparisonMethod = 'pixel'>(options: VisOptions<M> = { preset: 'auto' } as any) {\n\treturn {\n\t\tname: NAME,\n\t\tconfig(this: unknown, userConfig) {\n\t\t\tsetVisOption(userConfig, options)\n\t\t\tconst preset = options?.preset\n\t\t\treturn {\n\t\t\t\ttest: {\n\t\t\t\t\tbrowser: {\n\t\t\t\t\t\tname: undefined,\n\t\t\t\t\t\tcommands: commands as any,\n\t\t\t\t\t},\n\t\t\t\t\tsetupFiles: preset && preset !== '
|
|
1
|
+
{"version":3,"file":"vis.mjs","names":[],"sources":["../../src/config/vis.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config'\nimport { commands } from '../server/commands/commands.ts'\nimport { setVisOption } from '../server/vis_options.ts'\nimport { NAME } from '../shared/constants.ts'\nimport type { ComparisonMethod } from '../shared/types.ts'\nimport type { VisOptions } from './types.ts'\n\n/**\n * Create a Vite plugin for visual testing.\n *\n * If options are not provided, the plugin will use the default options,\n * which enables the `auto` preset.\n */\nexport function vis<M extends ComparisonMethod = 'pixel'>(options: VisOptions<M> = { preset: 'auto' } as any) {\n\treturn {\n\t\tname: NAME,\n\t\tconfig(this: unknown, userConfig) {\n\t\t\tsetVisOption(userConfig, options)\n\t\t\tconst preset = options?.preset\n\t\t\treturn {\n\t\t\t\ttest: {\n\t\t\t\t\tbrowser: {\n\t\t\t\t\t\tname: undefined,\n\t\t\t\t\t\tcommands: commands as any,\n\t\t\t\t\t},\n\t\t\t\t\tsetupFiles: preset && preset !== 'custom' ? [`vitest-plugin-vis/presets/${preset}`] : [],\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t} satisfies Plugin\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,IAA0C,UAAyB,EAAE,QAAQ,QAAQ,EAAS;AAC7G,QAAO;EACN,MAAM;EACN,OAAsB,YAAY;AACjC,gBAAa,YAAY,QAAQ;GACjC,MAAM,SAAS,SAAS;AACxB,UAAO,EACN,MAAM;IACL,SAAS;KACR,MAAM;KACI;KACV;IACD,YAAY,UAAU,WAAW,WAAW,CAAC,6BAA6B,SAAS,GAAG,EAAE;IACxF,EACD;;EAEF"}
|
package/dist/presets/auto.mjs
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { setAutoSnapshotOptions } from "../auto_snapshots/auto_snapshot_options.mjs";
|
|
2
|
-
import "../index.mjs";
|
|
3
1
|
import { vis } from "../setup/vis.mjs";
|
|
4
2
|
import "../setup.mjs";
|
|
5
|
-
import { afterEach, beforeAll } from "vitest";
|
|
6
3
|
|
|
7
4
|
//#region src/presets/auto.ts
|
|
8
|
-
|
|
9
|
-
await vis.beforeAll.setup();
|
|
10
|
-
setAutoSnapshotOptions(true);
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => vis.afterEach.matchImageSnapshot());
|
|
5
|
+
vis.setup({ auto: true });
|
|
13
6
|
|
|
14
7
|
//#endregion
|
|
15
8
|
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.mjs","names":[],"sources":["../../src/presets/auto.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"auto.mjs","names":[],"sources":["../../src/presets/auto.ts"],"sourcesContent":["import { vis } from '../setup.ts'\n\nvis.setup({ auto: true })\n"],"mappings":";;;;AAEA,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC"}
|
package/dist/presets/manual.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { vis } from "../setup/vis.mjs";
|
|
2
2
|
import "../setup.mjs";
|
|
3
|
-
import { afterEach, beforeAll } from "vitest";
|
|
4
3
|
|
|
5
4
|
//#region src/presets/manual.ts
|
|
6
|
-
|
|
7
|
-
afterEach(() => vis.afterEach.matchImageSnapshot());
|
|
5
|
+
vis.setup({ auto: false });
|
|
8
6
|
|
|
9
7
|
//#endregion
|
|
10
8
|
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manual.mjs","names":[],"sources":["../../src/presets/manual.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"manual.mjs","names":[],"sources":["../../src/presets/manual.ts"],"sourcesContent":["import { vis } from '../setup.ts'\n\nvis.setup({ auto: false })\n"],"mappings":";;;;AAEA,IAAI,MAAM,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import "../shared/types.mjs";
|
|
2
|
-
import "type-plus";
|
|
1
|
+
import "../shared/types.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComparisonMethod, SetupVisOptions } from "../shared/types.mjs";
|
|
1
|
+
import { SetupVisOptions } from "../shared/types.mjs";
|
|
3
2
|
import { SetupVisSuiteCommand } from "../shared/commands.types.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/setup/create_vis.d.ts
|
|
@@ -37,70 +36,6 @@ type VisClientConfigurator<GM extends Record<string, any> | unknown = unknown> =
|
|
|
37
36
|
* ```
|
|
38
37
|
*/
|
|
39
38
|
setup(options?: SetupVisOptions<GM>): void;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated Use `vis.setup()` instead.
|
|
42
|
-
*/
|
|
43
|
-
presets: {
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated Use `vis.setup()` instead.
|
|
46
|
-
*
|
|
47
|
-
* Enable visual testing.
|
|
48
|
-
*
|
|
49
|
-
* auto snapshot is turned off by default.
|
|
50
|
-
* You can specify the test to take a snapshot during `afterEach()` hook with `setAutoSnapshotOptions()`.
|
|
51
|
-
*/
|
|
52
|
-
enable(): void;
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Use `vis.setup()` instead.
|
|
55
|
-
*
|
|
56
|
-
* Enable visual testing.
|
|
57
|
-
*
|
|
58
|
-
* `setAutoSnapshotOptions` will have no effect in this preset.
|
|
59
|
-
*/
|
|
60
|
-
manual(): void;
|
|
61
|
-
/**
|
|
62
|
-
* @deprecated Use `vis.setup()` instead.
|
|
63
|
-
*
|
|
64
|
-
* Enable automatic visual testing.
|
|
65
|
-
*
|
|
66
|
-
* This will take a snapshot after each test.
|
|
67
|
-
*/
|
|
68
|
-
auto(): void;
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated Use `vis.setup()` instead.
|
|
71
|
-
*
|
|
72
|
-
* Enable automatic visual testing with multiple themes.
|
|
73
|
-
*
|
|
74
|
-
* This will take a snapshot after each test for each theme.
|
|
75
|
-
*
|
|
76
|
-
* @param themes A record of theme names and their setup functions.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```ts
|
|
80
|
-
* vis().presets.theme({
|
|
81
|
-
* light() { document.body.classList.add('light') },
|
|
82
|
-
* dark() { document.body.classList.add('dark') },
|
|
83
|
-
* })
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
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;
|
|
87
|
-
};
|
|
88
|
-
beforeAll: {
|
|
89
|
-
/**
|
|
90
|
-
* @deprecated No known use case.
|
|
91
|
-
*/
|
|
92
|
-
setup(): Promise<void>;
|
|
93
|
-
};
|
|
94
|
-
afterEach: {
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated No known use case.
|
|
97
|
-
*/
|
|
98
|
-
matchImageSnapshot(): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated No known use case.
|
|
101
|
-
*/
|
|
102
|
-
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>;
|
|
103
|
-
};
|
|
104
39
|
};
|
|
105
40
|
declare function createVis<GM extends Record<string, any> | unknown = unknown>(commands: SetupVisSuiteCommand): VisClientConfigurator<GM>;
|
|
106
41
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_vis.d.mts","names":[],"sources":["../../src/setup/create_vis.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create_vis.d.mts","names":[],"sources":["../../src/setup/create_vis.ts"],"sourcesContent":[],"mappings":";;;;;;;AASA;AAA6C,KAAjC,qBAAiC,CAAA,WAAA,MAAA,CAAA,MAAA,EAAA,GAAA,CAAA,GAAA,OAAA,GAAA,OAAA,CAAA,GAAA;EA6BZ;;;AAGjC;;;;;;;;;;;;;;;;;;;;;;;;;kBAHiB,gBAAgB;;iBAGjB,qBAAqB,mDAAmD,uBAAoB,sBAAA"}
|
|
@@ -5,52 +5,16 @@ import { afterEach, beforeAll, expect } from "vitest";
|
|
|
5
5
|
//#region src/setup/create_vis.ts
|
|
6
6
|
function createVis(commands) {
|
|
7
7
|
const matcher = autoSnapshotMatcher(commands, expect);
|
|
8
|
-
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
else beforeAll(async () => {
|
|
12
|
-
await matcher.setup();
|
|
13
|
-
setAutoSnapshotOptions(true);
|
|
14
|
-
});
|
|
15
|
-
if (typeof options?.auto === "function") afterEach(matcher.createMatcher({ auto: options.auto }));
|
|
16
|
-
else if (typeof options?.auto === "object") afterEach(matcher.createMatcher(options.auto));
|
|
17
|
-
else afterEach(matcher.createMatcher({ async auto() {} }));
|
|
18
|
-
},
|
|
19
|
-
presets: {
|
|
20
|
-
enable() {
|
|
21
|
-
beforeAll(matcher.setup);
|
|
22
|
-
afterEach(matcher.createMatcher({ async auto() {} }));
|
|
23
|
-
},
|
|
24
|
-
manual() {
|
|
25
|
-
beforeAll(matcher.setup);
|
|
26
|
-
},
|
|
27
|
-
auto() {
|
|
28
|
-
beforeAll(async () => {
|
|
29
|
-
await matcher.setup();
|
|
30
|
-
setAutoSnapshotOptions(true);
|
|
31
|
-
});
|
|
32
|
-
afterEach(matcher.createMatcher({ async auto() {} }));
|
|
33
|
-
},
|
|
34
|
-
theme(themes) {
|
|
35
|
-
beforeAll(async () => {
|
|
36
|
-
await matcher.setup();
|
|
37
|
-
setAutoSnapshotOptions(true);
|
|
38
|
-
});
|
|
39
|
-
afterEach(matcher.createMatcher(themes));
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
beforeAll: { async setup() {
|
|
8
|
+
return { setup(options) {
|
|
9
|
+
if (!options || options.auto === false) beforeAll(matcher.setup);
|
|
10
|
+
else beforeAll(async () => {
|
|
43
11
|
await matcher.setup();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return matcher.createMatcher(themes);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
12
|
+
setAutoSnapshotOptions(true);
|
|
13
|
+
});
|
|
14
|
+
if (typeof options?.auto === "function") afterEach(matcher.createMatcher({ auto: options.auto }));
|
|
15
|
+
else if (typeof options?.auto === "object") afterEach(matcher.createMatcher(options.auto));
|
|
16
|
+
else afterEach(matcher.createMatcher({ async auto() {} }));
|
|
17
|
+
} };
|
|
54
18
|
}
|
|
55
19
|
|
|
56
20
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_vis.mjs","names":[],"sources":["../../src/setup/create_vis.ts"],"sourcesContent":["import { afterEach, beforeAll, expect } from 'vitest'\nimport { setAutoSnapshotOptions } from '../auto_snapshots/auto_snapshot_options.ts'\nimport
|
|
1
|
+
{"version":3,"file":"create_vis.mjs","names":[],"sources":["../../src/setup/create_vis.ts"],"sourcesContent":["import { afterEach, beforeAll, expect } from 'vitest'\nimport { setAutoSnapshotOptions } from '../auto_snapshots/auto_snapshot_options.ts'\nimport { autoSnapshotMatcher } from '../client/suite/auto_snapshot_matcher.ts'\nimport type { SetupVisSuiteCommand } from '../shared/commands.types.ts'\nimport type { SetupVisOptions } from '../shared/types.ts'\n\n/**\n * Visual test configuration on the client side.\n */\nexport type VisClientConfigurator<GM extends Record<string, any> | unknown = unknown> = {\n\t/**\n\t * Setup the visual test configuration.\n\t *\n\t * @example\n\t * ```ts\n\t * // Setup with auto snapshot enabled\n\t * vis().setup({ auto: true })\n\t *\n\t * // Setup with auto snapshot disabled\n\t * vis().setup({ auto: false })\n\t *\n\t * // Same as `vis.setup({ auto: false })`\n\t * vis.setup()\n\t *\n\t * // Setup with auto snapshot determined by the test meta\n\t * vis.setup({\n\t * \tauto: async ({ meta }) => meta['darkOnly'],\n\t * })\n\t *\n\t * // Setup with multiple auto snapshots\n\t * vis.setup({\n\t * auto: {\n\t * async light() { document.body.classList.remove('dark') },\n\t * async dark() { document.body.classList.add('dark') },\n\t * }\n\t * })\n\t * ```\n\t */\n\tsetup(options?: SetupVisOptions<GM>): void\n}\n\nexport function createVis<GM extends Record<string, any> | unknown = unknown>(commands: SetupVisSuiteCommand) {\n\tconst matcher = autoSnapshotMatcher(commands, expect)\n\n\tconst vis: VisClientConfigurator<GM> = {\n\t\tsetup(options) {\n\t\t\tif (!options || options.auto === false) {\n\t\t\t\tbeforeAll(matcher.setup)\n\t\t\t} else {\n\t\t\t\tbeforeAll(async () => {\n\t\t\t\t\tawait matcher.setup()\n\t\t\t\t\tsetAutoSnapshotOptions(true)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (typeof options?.auto === 'function') {\n\t\t\t\tafterEach(matcher.createMatcher({ auto: options.auto }))\n\t\t\t} else if (typeof options?.auto === 'object') {\n\t\t\t\tafterEach(matcher.createMatcher(options.auto))\n\t\t\t} else {\n\t\t\t\tafterEach(matcher.createMatcher({ async auto() {} }))\n\t\t\t}\n\t\t},\n\t}\n\treturn vis\n}\n"],"mappings":";;;;;AAyCA,SAAgB,UAA8D,UAAgC;CAC7G,MAAM,UAAU,oBAAoB,UAAU,OAAO;AAsBrD,QApBuC,EACtC,MAAM,SAAS;AACd,MAAI,CAAC,WAAW,QAAQ,SAAS,MAChC,WAAU,QAAQ,MAAM;MAExB,WAAU,YAAY;AACrB,SAAM,QAAQ,OAAO;AACrB,0BAAuB,KAAK;IAC3B;AAGH,MAAI,OAAO,SAAS,SAAS,WAC5B,WAAU,QAAQ,cAAc,EAAE,MAAM,QAAQ,MAAM,CAAC,CAAC;WAC9C,OAAO,SAAS,SAAS,SACnC,WAAU,QAAQ,cAAc,QAAQ,KAAK,CAAC;MAE9C,WAAU,QAAQ,cAAc,EAAE,MAAM,OAAO,IAAI,CAAC,CAAC;IAGvD"}
|
package/dist/setup.d.mts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { createVis as createVis$1 } from "./setup/create_vis.mjs";
|
|
2
1
|
import "./setup-api.mjs";
|
|
3
2
|
import { vis } from "./setup/vis.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/setup.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use `createVis` from `vitest-plugin-vis/setup-api` instead.
|
|
9
|
-
*/
|
|
10
|
-
declare const createVis: typeof createVis$1;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { createVis, vis };
|
|
13
|
-
//# sourceMappingURL=setup.d.mts.map
|
|
3
|
+
export { vis };
|
package/dist/setup.mjs
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { createVis as createVis$1 } from "./setup/create_vis.mjs";
|
|
2
1
|
import "./setup-api.mjs";
|
|
3
2
|
import { vis } from "./setup/vis.mjs";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use `createVis` from `vitest-plugin-vis/setup-api` instead.
|
|
8
|
-
*/
|
|
9
|
-
const createVis = createVis$1;
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { createVis, vis };
|
|
13
|
-
//# sourceMappingURL=setup.mjs.map
|
|
4
|
+
export { vis };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-plugin-vis",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Vitest visual testing plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"image-snapshot",
|
|
@@ -42,10 +42,6 @@
|
|
|
42
42
|
"types": "./dist/presets/auto.d.mts",
|
|
43
43
|
"default": "./dist/presets/auto.mjs"
|
|
44
44
|
},
|
|
45
|
-
"./presets/enable": {
|
|
46
|
-
"types": "./dist/presets/enable.d.mts",
|
|
47
|
-
"default": "./dist/presets/enable.mjs"
|
|
48
|
-
},
|
|
49
45
|
"./presets/manual": {
|
|
50
46
|
"types": "./dist/presets/manual.d.mts",
|
|
51
47
|
"default": "./dist/presets/manual.mjs"
|
|
@@ -87,36 +83,35 @@
|
|
|
87
83
|
"type-plus": "8.0.0-beta.8"
|
|
88
84
|
},
|
|
89
85
|
"devDependencies": {
|
|
90
|
-
"@repobuddy/storybook": "^2.
|
|
86
|
+
"@repobuddy/storybook": "^2.28.0",
|
|
91
87
|
"@repobuddy/typescript": "^2.1.0",
|
|
92
|
-
"@storybook-community/storybook-dark-mode": "^7.1.
|
|
93
|
-
"@storybook/addon-docs": "^10.
|
|
94
|
-
"@storybook/addon-
|
|
95
|
-
"@storybook/
|
|
96
|
-
"@storybook/react-vite": "^10.1.10",
|
|
88
|
+
"@storybook-community/storybook-dark-mode": "^7.1.1",
|
|
89
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
90
|
+
"@storybook/addon-vitest": "^10.3.5",
|
|
91
|
+
"@storybook/react-vite": "^10.3.5",
|
|
97
92
|
"@tailwindcss/vite": "^4.1.14",
|
|
98
93
|
"@types/is-ci": "^3.0.4",
|
|
99
94
|
"@types/pngjs": "^6.0.5",
|
|
100
95
|
"@types/react": "^19.2.2",
|
|
101
|
-
"@vitest/browser": "^4.
|
|
102
|
-
"@vitest/browser-playwright": "^4.
|
|
103
|
-
"@vitest/browser-webdriverio": "^4.
|
|
104
|
-
"@vitest/coverage-istanbul": "^4.
|
|
105
|
-
"@vitest/coverage-v8": "^4.
|
|
106
|
-
"@vitest/expect": "^4.
|
|
107
|
-
"@vitest/ui": "^4.
|
|
96
|
+
"@vitest/browser": "^4.1.4",
|
|
97
|
+
"@vitest/browser-playwright": "^4.1.4",
|
|
98
|
+
"@vitest/browser-webdriverio": "^4.1.4",
|
|
99
|
+
"@vitest/coverage-istanbul": "^4.1.4",
|
|
100
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
101
|
+
"@vitest/expect": "^4.1.4",
|
|
102
|
+
"@vitest/ui": "^4.1.4",
|
|
108
103
|
"cross-env": "^10.0.0",
|
|
109
104
|
"never-fail": "^1.1.4",
|
|
110
105
|
"npm-run-all2": "^8.0.0",
|
|
111
106
|
"react": "^19.0.0",
|
|
112
107
|
"react-dom": "^19.0.0",
|
|
113
|
-
"storybook": "^10.
|
|
114
|
-
"storybook-addon-tag-badges": "^3.0
|
|
108
|
+
"storybook": "^10.3.5",
|
|
109
|
+
"storybook-addon-tag-badges": "^3.1.0",
|
|
115
110
|
"tailwindcss": "^4.1.14",
|
|
116
111
|
"tsdown": "^0.19.0",
|
|
117
112
|
"typescript": "^5.9.3",
|
|
118
|
-
"vite": "^
|
|
119
|
-
"vitest": "^4.
|
|
113
|
+
"vite": "^8.0.0",
|
|
114
|
+
"vitest": "^4.1.4",
|
|
120
115
|
"vitest-browser-react": "^2.0.2"
|
|
121
116
|
},
|
|
122
117
|
"peerDependencies": {
|
package/readme.md
CHANGED
|
@@ -79,7 +79,7 @@ import { vis } from 'vitest-plugin-vis/config'
|
|
|
79
79
|
export default defineConfig({
|
|
80
80
|
plugins: [
|
|
81
81
|
vis({
|
|
82
|
-
preset: 'auto' // or 'manual' or '
|
|
82
|
+
preset: 'auto' // or 'manual' or 'custom'
|
|
83
83
|
})
|
|
84
84
|
],
|
|
85
85
|
})
|
|
@@ -87,14 +87,14 @@ export default defineConfig({
|
|
|
87
87
|
|
|
88
88
|
- `auto` (default): Automatically take a snapshot at the end of each rendering test.
|
|
89
89
|
- `manual`: You control which test(s) should take a snapshot automatically with the `setAutoSnapshotOptions()` function.
|
|
90
|
-
- `
|
|
90
|
+
- `custom`: No preset setup file from the plugin. Set up your visual testing strategy in `vitest.setup.ts`.
|
|
91
91
|
|
|
92
92
|
When using the `auto` or `manual` preset,
|
|
93
93
|
manual snapshots are enabled. You can take manual snapshot using the `expect().toMatchImageSnapshot()` matcher,
|
|
94
94
|
or the `page.toMatchImageSnapshot()` for full page snapshot.
|
|
95
95
|
|
|
96
96
|
If you want to customize the snapshot behavior,
|
|
97
|
-
you can set the `preset` to `
|
|
97
|
+
you can set the `preset` to `custom` and configure your own snapshot strategy in `vitest.setup.ts`:
|
|
98
98
|
|
|
99
99
|
```ts
|
|
100
100
|
// vitest.config.ts
|
|
@@ -103,7 +103,7 @@ import { vis } from 'vitest-plugin-vis/config'
|
|
|
103
103
|
|
|
104
104
|
export default defineConfig({
|
|
105
105
|
plugins: [
|
|
106
|
-
vis({ preset: '
|
|
106
|
+
vis({ preset: 'custom' })
|
|
107
107
|
],
|
|
108
108
|
test: {
|
|
109
109
|
browser: {/* ... */},
|
|
@@ -2,7 +2,6 @@ import type { ImageSnapshotMatcher } from './to_match_image_snapshot.types.ts'
|
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
namespace jest {
|
|
5
|
-
// biome-ignore lint/correctness/noUnusedVariables: augmentation must have matching type params.
|
|
6
5
|
interface Matchers<R, T> extends ImageSnapshotMatcher {}
|
|
7
6
|
}
|
|
8
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SerializedConfig } from 'vitest'
|
|
2
|
-
import type { BrowserCommands
|
|
2
|
+
import type { BrowserCommands } from 'vitest/browser'
|
|
3
3
|
|
|
4
4
|
let ctx: Awaited<typeof import('vitest/browser')>
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ export const server = new Proxy<{
|
|
|
14
14
|
* Platform the Vitest server is running on.
|
|
15
15
|
* The same as calling `process.platform` on the server.
|
|
16
16
|
*/
|
|
17
|
-
platform:
|
|
17
|
+
platform: string
|
|
18
18
|
/**
|
|
19
19
|
* Runtime version of the Vitest server.
|
|
20
20
|
* The same as calling `process.version` on the server.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { SnapshotTestMeta } from '../../../shared/types.ts'
|
|
2
2
|
|
|
3
|
-
let
|
|
3
|
+
let vitest: Awaited<typeof import('vitest')>
|
|
4
4
|
|
|
5
5
|
if ((globalThis as any).__vitest_browser__) {
|
|
6
|
-
import('vitest
|
|
7
|
-
|
|
6
|
+
import('vitest').then((m) => {
|
|
7
|
+
vitest = m
|
|
8
8
|
})
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export type CurrentTest = ReturnType<typeof
|
|
11
|
+
export type CurrentTest = ReturnType<typeof vitest.TestRunner.getCurrentTest> & SnapshotTestMeta
|
|
12
12
|
|
|
13
|
-
export const getCurrentTest = () =>
|
|
14
|
-
export const getCurrentSuite = () =>
|
|
13
|
+
export const getCurrentTest = () => vitest?.TestRunner.getCurrentTest() as CurrentTest
|
|
14
|
+
export const getCurrentSuite = () => vitest?.TestRunner.getCurrentSuite()
|
package/src/client/page/_ctx.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { commands, type BrowserCommands, type BrowserPage } from 'vitest/browser'
|
|
2
2
|
import { getCurrentTest } from '../external/vitest/vitest_suite_proxy.ts'
|
|
3
3
|
|
|
4
4
|
export type { BrowserPage }
|
|
5
5
|
|
|
6
6
|
export const ctx = {
|
|
7
|
-
commands,
|
|
7
|
+
commands: commands as BrowserCommands,
|
|
8
8
|
getCurrentTest,
|
|
9
9
|
__test__reset() {
|
|
10
10
|
ctx.getCurrentTest = getCurrentTest
|
package/src/config/types.ts
CHANGED
|
@@ -35,10 +35,8 @@ export type VisOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim'
|
|
|
35
35
|
* Loads the `test.setupFiles` of the specified preset.
|
|
36
36
|
*
|
|
37
37
|
* @default 'auto'
|
|
38
|
-
* @deprecated 'enable' is deprecated. Use `manual` for the same effect.
|
|
39
|
-
* @deprecated 'none' is deprecated. Use `custom` for the same effect.
|
|
40
38
|
*/
|
|
41
|
-
preset?: '
|
|
39
|
+
preset?: 'manual' | 'auto' | 'custom' | undefined
|
|
42
40
|
/**
|
|
43
41
|
* The snapshot folder relative to the root of the project.
|
|
44
42
|
*
|
package/src/config/vis.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function vis<M extends ComparisonMethod = 'pixel'>(options: VisOptions<M>
|
|
|
23
23
|
name: undefined,
|
|
24
24
|
commands: commands as any,
|
|
25
25
|
},
|
|
26
|
-
setupFiles: preset && preset !== '
|
|
26
|
+
setupFiles: preset && preset !== 'custom' ? [`vitest-plugin-vis/presets/${preset}`] : [],
|
|
27
27
|
},
|
|
28
28
|
}
|
|
29
29
|
},
|
package/src/presets/auto.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { afterEach, beforeAll } from 'vitest'
|
|
2
|
-
import { setAutoSnapshotOptions } from '../index.ts'
|
|
3
1
|
import { vis } from '../setup.ts'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
await vis.beforeAll.setup()
|
|
7
|
-
setAutoSnapshotOptions(true)
|
|
8
|
-
})
|
|
9
|
-
afterEach(() => vis.afterEach.matchImageSnapshot())
|
|
3
|
+
vis.setup({ auto: true })
|
package/src/presets/manual.ts
CHANGED
package/src/setup/create_vis.mdx
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { Meta, Markdown ,Canvas} from "@storybook/addon-docs/blocks";
|
|
2
2
|
|
|
3
|
-
<Meta title="setup/createVis"
|
|
3
|
+
<Meta title="setup/createVis" />
|
|
4
4
|
|
|
5
5
|
# `createVis`
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`createVis` in `vitest-plugin-vis/setup` is deprecated.
|
|
10
|
-
|
|
11
|
-
It is moved to `vitest-plugin-vis/setup-api`.
|
|
7
|
+
Import `createVis` from `vitest-plugin-vis/setup-api` (not from `vitest-plugin-vis/setup`).
|
package/src/setup/create_vis.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { afterEach, beforeAll, expect } from 'vitest'
|
|
2
2
|
import { setAutoSnapshotOptions } from '../auto_snapshots/auto_snapshot_options.ts'
|
|
3
|
-
import type { SnapshotMeta } from '../auto_snapshots/snapshot_meta.ts'
|
|
4
3
|
import { autoSnapshotMatcher } from '../client/suite/auto_snapshot_matcher.ts'
|
|
5
4
|
import type { SetupVisSuiteCommand } from '../shared/commands.types.ts'
|
|
6
|
-
import type {
|
|
5
|
+
import type { SetupVisOptions } from '../shared/types.ts'
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Visual test configuration on the client side.
|
|
@@ -38,80 +37,6 @@ export type VisClientConfigurator<GM extends Record<string, any> | unknown = unk
|
|
|
38
37
|
* ```
|
|
39
38
|
*/
|
|
40
39
|
setup(options?: SetupVisOptions<GM>): void
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated Use `vis.setup()` instead.
|
|
43
|
-
*/
|
|
44
|
-
presets: {
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Use `vis.setup()` instead.
|
|
47
|
-
*
|
|
48
|
-
* Enable visual testing.
|
|
49
|
-
*
|
|
50
|
-
* auto snapshot is turned off by default.
|
|
51
|
-
* You can specify the test to take a snapshot during `afterEach()` hook with `setAutoSnapshotOptions()`.
|
|
52
|
-
*/
|
|
53
|
-
enable(): void
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated Use `vis.setup()` instead.
|
|
56
|
-
*
|
|
57
|
-
* Enable visual testing.
|
|
58
|
-
*
|
|
59
|
-
* `setAutoSnapshotOptions` will have no effect in this preset.
|
|
60
|
-
*/
|
|
61
|
-
manual(): void
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Use `vis.setup()` instead.
|
|
64
|
-
*
|
|
65
|
-
* Enable automatic visual testing.
|
|
66
|
-
*
|
|
67
|
-
* This will take a snapshot after each test.
|
|
68
|
-
*/
|
|
69
|
-
auto(): void
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated Use `vis.setup()` instead.
|
|
72
|
-
*
|
|
73
|
-
* Enable automatic visual testing with multiple themes.
|
|
74
|
-
*
|
|
75
|
-
* This will take a snapshot after each test for each theme.
|
|
76
|
-
*
|
|
77
|
-
* @param themes A record of theme names and their setup functions.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* vis().presets.theme({
|
|
82
|
-
* light() { document.body.classList.add('light') },
|
|
83
|
-
* dark() { document.body.classList.add('dark') },
|
|
84
|
-
* })
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
theme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(
|
|
88
|
-
themes: Record<
|
|
89
|
-
string,
|
|
90
|
-
boolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)
|
|
91
|
-
>,
|
|
92
|
-
): void
|
|
93
|
-
}
|
|
94
|
-
beforeAll: {
|
|
95
|
-
/**
|
|
96
|
-
* @deprecated No known use case.
|
|
97
|
-
*/
|
|
98
|
-
setup(): Promise<void>
|
|
99
|
-
}
|
|
100
|
-
afterEach: {
|
|
101
|
-
/**
|
|
102
|
-
* @deprecated No known use case.
|
|
103
|
-
*/
|
|
104
|
-
matchImageSnapshot(): Promise<void>
|
|
105
|
-
/**
|
|
106
|
-
* @deprecated No known use case.
|
|
107
|
-
*/
|
|
108
|
-
matchPerTheme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(
|
|
109
|
-
themes: Record<
|
|
110
|
-
string,
|
|
111
|
-
boolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)
|
|
112
|
-
>,
|
|
113
|
-
): () => Promise<void>
|
|
114
|
-
}
|
|
115
40
|
}
|
|
116
41
|
|
|
117
42
|
export function createVis<GM extends Record<string, any> | unknown = unknown>(commands: SetupVisSuiteCommand) {
|
|
@@ -136,42 +61,6 @@ export function createVis<GM extends Record<string, any> | unknown = unknown>(co
|
|
|
136
61
|
afterEach(matcher.createMatcher({ async auto() {} }))
|
|
137
62
|
}
|
|
138
63
|
},
|
|
139
|
-
presets: {
|
|
140
|
-
enable() {
|
|
141
|
-
beforeAll(matcher.setup)
|
|
142
|
-
afterEach(matcher.createMatcher({ async auto() {} }))
|
|
143
|
-
},
|
|
144
|
-
manual() {
|
|
145
|
-
beforeAll(matcher.setup)
|
|
146
|
-
},
|
|
147
|
-
auto() {
|
|
148
|
-
beforeAll(async () => {
|
|
149
|
-
await matcher.setup()
|
|
150
|
-
setAutoSnapshotOptions(true)
|
|
151
|
-
})
|
|
152
|
-
afterEach(matcher.createMatcher({ async auto() {} }))
|
|
153
|
-
},
|
|
154
|
-
theme(themes) {
|
|
155
|
-
beforeAll(async () => {
|
|
156
|
-
await matcher.setup()
|
|
157
|
-
setAutoSnapshotOptions(true)
|
|
158
|
-
})
|
|
159
|
-
afterEach(matcher.createMatcher(themes))
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
beforeAll: {
|
|
163
|
-
async setup() {
|
|
164
|
-
await matcher.setup()
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
afterEach: {
|
|
168
|
-
async matchImageSnapshot() {
|
|
169
|
-
return matcher.createMatcher({ async auto() {} })()
|
|
170
|
-
},
|
|
171
|
-
matchPerTheme(themes) {
|
|
172
|
-
return matcher.createMatcher(themes)
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
64
|
}
|
|
176
65
|
return vis
|
|
177
66
|
}
|
package/src/setup.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import './setup-api.ts'
|
|
2
2
|
|
|
3
3
|
export * from './setup/vis.ts'
|
|
4
|
-
|
|
5
|
-
import { createVis as createVisDeprecated } from './setup/create_vis.ts'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Use `createVis` from `vitest-plugin-vis/setup-api` instead.
|
|
9
|
-
*/
|
|
10
|
-
export const createVis = createVisDeprecated
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/presets/enable.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { vis } from "../setup/vis.mjs";
|
|
2
|
-
import "../setup.mjs";
|
|
3
|
-
import { afterEach, beforeAll } from "vitest";
|
|
4
|
-
|
|
5
|
-
//#region src/presets/enable.ts
|
|
6
|
-
beforeAll(() => vis.beforeAll.setup());
|
|
7
|
-
afterEach(() => vis.afterEach.matchImageSnapshot());
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { };
|
|
11
|
-
//# sourceMappingURL=enable.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enable.mjs","names":[],"sources":["../../src/presets/enable.ts"],"sourcesContent":["import { afterEach, beforeAll } from 'vitest'\nimport { vis } from '../setup.ts'\n\nbeforeAll(() => vis.beforeAll.setup())\nafterEach(() => vis.afterEach.matchImageSnapshot())\n"],"mappings":";;;;;AAGA,gBAAgB,IAAI,UAAU,OAAO,CAAC;AACtC,gBAAgB,IAAI,UAAU,oBAAoB,CAAC"}
|
package/dist/setup.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.mts","names":[],"sources":["../src/setup.ts"],"sourcesContent":[],"mappings":";;;;;;;;AASA;cAAa,kBAAS"}
|
package/dist/setup.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.mjs","names":["createVisDeprecated"],"sources":["../src/setup.ts"],"sourcesContent":["import './setup-api.ts'\n\nexport * from './setup/vis.ts'\n\nimport { createVis as createVisDeprecated } from './setup/create_vis.ts'\n\n/**\n * @deprecated Use `createVis` from `vitest-plugin-vis/setup-api` instead.\n */\nexport const createVis = createVisDeprecated\n"],"mappings":";;;;;;;;AASA,MAAa,YAAYA"}
|