vitest-plugin-vis 2.4.0 → 2.4.2

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.
@@ -3,7 +3,7 @@ export declare const visContext: {
3
3
  __test__getOptions(projectName: string): import("../config.ts").VisOptions<any> | undefined;
4
4
  __test__reset(): void;
5
5
  __test__getState(context: import("./vis_context.types.ts").PartialBrowserCommandContext): Promise<import("./vis_context.types.ts").VisProjectState>;
6
- setupSuite(context: import("./vis_context.types.ts").PartialBrowserCommandContext): Promise<import("type-plus").Pick._<import("./vis_context.types.ts").VisProjectState, "subjectDataTestId">>;
6
+ setupSuite(browserContext: import("./vis_context.types.ts").PartialBrowserCommandContext): Promise<import("type-plus").Pick._<import("./vis_context.types.ts").VisProjectState, "subjectDataTestId">>;
7
7
  getSnapshotInfo(browserContext: import("./vis_context.types.ts").PartialBrowserCommandContext, name: string, isAutoSnapshot: boolean, options?: {
8
8
  snapshotFileId?: string | undefined;
9
9
  }): Promise<{
@@ -11,17 +11,15 @@ export declare const visContext: {
11
11
  resultPath: string;
12
12
  diffPath: string;
13
13
  timeout?: number | undefined | undefined;
14
- failureThresholdType?: "pixel" | "percent" | undefined | undefined;
15
- failureThreshold?: number | undefined | undefined;
16
14
  comparisonMethod: any;
17
15
  diffOptions?: Partial<import("ssim.js").Options> | undefined;
16
+ failureThresholdType?: "pixel" | "percent" | undefined | undefined;
17
+ failureThreshold?: number | undefined | undefined;
18
18
  } | {
19
19
  baselinePath: string;
20
20
  resultPath: string;
21
21
  diffPath: string;
22
22
  timeout?: number | undefined | undefined;
23
- failureThresholdType?: "pixel" | "percent" | undefined | undefined;
24
- failureThreshold?: number | undefined | undefined;
25
23
  comparisonMethod?: any;
26
24
  diffOptions?: {
27
25
  threshold?: number | undefined;
@@ -32,6 +30,8 @@ export declare const visContext: {
32
30
  diffColorAlt?: [number, number, number] | undefined;
33
31
  diffMask?: boolean | undefined;
34
32
  } | undefined;
33
+ failureThresholdType?: "pixel" | "percent" | undefined | undefined;
34
+ failureThreshold?: number | undefined | undefined;
35
35
  }>;
36
36
  getTaskCount(browserContext: import("./vis_context.types.ts").PartialBrowserCommandContext, taskId: string): Promise<number>;
37
37
  hasImageSnapshot(browserContext: import("./vis_context.types.ts").PartialBrowserCommandContext, taskId: string, snapshotFileId: string | undefined, isAutoSnapshot: boolean): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"vis_context.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;sBACq6D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADj5D,CAAA"}
1
+ {"version":3,"file":"vis_context.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;sBAC86D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAD15D,CAAA"}
@@ -10,7 +10,7 @@ export declare function createVisContext(): {
10
10
  * Test files include vitest test files and storybook story files.
11
11
  * It needs to make sure there is no race condition between the test files.
12
12
  */
13
- setupSuite(context: PartialBrowserCommandContext): Promise<import("type-plus").Pick._<VisProjectState, "subjectDataTestId">>;
13
+ setupSuite(browserContext: PartialBrowserCommandContext): Promise<import("type-plus").Pick._<VisProjectState, "subjectDataTestId">>;
14
14
  getSnapshotInfo(browserContext: PartialBrowserCommandContext, name: string, isAutoSnapshot: boolean, options?: {
15
15
  snapshotFileId?: string | undefined;
16
16
  }): Promise<{
@@ -18,17 +18,15 @@ export declare function createVisContext(): {
18
18
  resultPath: string;
19
19
  diffPath: string;
20
20
  timeout?: number | undefined | undefined;
21
- failureThresholdType?: "pixel" | "percent" | undefined | undefined;
22
- failureThreshold?: number | undefined | undefined;
23
21
  comparisonMethod: any;
24
22
  diffOptions?: Partial<import("ssim.js").Options> | undefined;
23
+ failureThresholdType?: "pixel" | "percent" | undefined | undefined;
24
+ failureThreshold?: number | undefined | undefined;
25
25
  } | {
26
26
  baselinePath: string;
27
27
  resultPath: string;
28
28
  diffPath: string;
29
29
  timeout?: number | undefined | undefined;
30
- failureThresholdType?: "pixel" | "percent" | undefined | undefined;
31
- failureThreshold?: number | undefined | undefined;
32
30
  comparisonMethod?: any;
33
31
  diffOptions?: {
34
32
  threshold?: number | undefined;
@@ -39,6 +37,8 @@ export declare function createVisContext(): {
39
37
  diffColorAlt?: [number, number, number] | undefined;
40
38
  diffMask?: boolean | undefined;
41
39
  } | undefined;
40
+ failureThresholdType?: "pixel" | "percent" | undefined | undefined;
41
+ failureThreshold?: number | undefined | undefined;
42
42
  }>;
43
43
  getTaskCount(browserContext: PartialBrowserCommandContext, taskId: string): Promise<number>;
44
44
  hasImageSnapshot(browserContext: PartialBrowserCommandContext, taskId: string, snapshotFileId: string | undefined, isAutoSnapshot: boolean): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"vis_context.logic.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.logic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAMpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,eAAe,EAAY,MAAM,wBAAwB,CAAA;AAErG,wBAAgB,gBAAgB;eAKnB,CAAC,SAAS,OAAO,GAAG,MAAM,eAAe,MAAM,GAAG,SAAS,YAAW,UAAU,CAAC,CAAC,CAAC;oCAG9D,MAAM;;8BAOZ,4BAA4B;IAItD;;;;OAIG;wBACuB,4BAA4B;oCAgBrC,4BAA4B,QACtC,MAAM,kBACI,OAAO,YACb;QAAE,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA+Bf,4BAA4B,UAAU,MAAM;qCAI9D,4BAA4B,UACpC,MAAM,kBACE,MAAM,GAAG,SAAS,kBAClB,OAAO;wCAaP,4BAA4B,QACt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ClB,OAAO;iCAWW,4BAA4B,UAAU,MAAM;;;;;;;;;;;EAmBhF;AAyBD,wBAAgB,WAAW,CAC1B,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC;;;;;;;;EAYrD;AAED,wBAAgB,UAAU,CACzB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC,UAGrD"}
@@ -20,21 +20,21 @@ export function createVisContext() {
20
20
  state = {};
21
21
  },
22
22
  __test__getState(context) {
23
- const projectRoot = getProjectRoot(context);
24
- return state[projectRoot];
23
+ return state[getProjectId(context)];
25
24
  },
26
25
  /**
27
26
  * Setup suite is called on each test file's beforeAll hook.
28
27
  * Test files include vitest test files and storybook story files.
29
28
  * It needs to make sure there is no race condition between the test files.
30
29
  */
31
- async setupSuite(context) {
32
- const projectRoot = getProjectRoot(context);
33
- if (!state[projectRoot]) {
34
- state[projectRoot] = setupState(context, getVisOptions(visOptionsRecord, context) ?? {});
30
+ async setupSuite(browserContext) {
31
+ const projectId = getProjectId(browserContext);
32
+ const visOptions = getVisOptions(visOptionsRecord, browserContext);
33
+ if (!state[projectId]) {
34
+ state[projectId] = setupState(browserContext, visOptions);
35
35
  }
36
- const projectState = await state[projectRoot];
37
- const { suiteId, suite } = createSuite(projectState, context.testPath, visOptionsRecord);
36
+ const projectState = await state[projectId];
37
+ const { suiteId, suite } = createSuite(projectState, browserContext.testPath, visOptions);
38
38
  projectState.suites[suiteId] = suite;
39
39
  await Promise.allSettled([ctx.rimraf(suite.diffDir), ctx.rimraf(suite.resultDir)]);
40
40
  return pick(projectState, 'subjectDataTestId');
@@ -72,13 +72,14 @@ export function createVisContext() {
72
72
  })}.png`;
73
73
  },
74
74
  async getSuiteInfo(browserContext, taskId) {
75
- const projectRoot = getProjectRoot(browserContext);
76
- const projectState = await state[projectRoot];
77
- const suiteId = getSuiteId(projectState, browserContext.testPath, visOptionsRecord);
75
+ const projectId = getProjectId(browserContext);
76
+ const projectState = await state[projectId];
77
+ const visOptions = getVisOptions(visOptionsRecord, browserContext);
78
+ const suiteId = getSuiteId(projectState, browserContext.testPath, visOptions);
78
79
  const suite = projectState.suites[suiteId];
79
80
  const task = (suite.tasks[taskId] = suite.tasks[taskId] ?? { count: 1 });
80
81
  return {
81
- projectRoot,
82
+ projectRoot: projectState.projectRoot,
82
83
  suiteId,
83
84
  taskId,
84
85
  baselineDir: suite.baselineDir,
@@ -124,8 +125,11 @@ export function getSuiteId(state, testPath, options) {
124
125
  return getSnapshotSubpath(relative(state.projectRoot, testPath), options);
125
126
  }
126
127
  function getVisOptions(visOptionsRecord, context) {
127
- return visOptionsRecord[getProjectName(context) ?? '__default'];
128
+ return visOptionsRecord[getProjectName(context) ?? '__default'] ?? {};
128
129
  }
129
130
  function getProjectRoot(context) {
130
131
  return context.project.config.root;
131
132
  }
133
+ function getProjectId(context) {
134
+ return `${context.project.config.root}/${context.project.config.name}`;
135
+ }
@@ -23,6 +23,7 @@ export type VisProjectState = {
23
23
  export type PartialBrowserCommandContext = {
24
24
  project: {
25
25
  config: {
26
+ name: string;
26
27
  root: string;
27
28
  snapshotOptions: {
28
29
  updateSnapshot: 'all' | 'new' | 'none';
@@ -1 +1 @@
1
- {"version":3,"file":"vis_context.types.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACtB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;CAC/C,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,MAAM,EAAE,MAAM,CACb,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAA;QACnB,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,MAAM,CACZ,MAAM,EACN;YACC,KAAK,EAAE,MAAM,CAAA;SACb,CACD,CAAA;KACD,CACD,CAAA;CACD,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IAC1C,OAAO,EAAE;QACR,MAAM,EAAE;YACP,IAAI,EAAE,MAAM,CAAA;YACZ,eAAe,EAAE;gBAChB,cAAc,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;aACtC,CAAA;YACD,WAAW,EAAE,MAAM,CAAA;YACnB,WAAW,EAAE,MAAM,CAAA;SACnB,CAAA;QACD,IAAI,EAAE;YACL,MAAM,EAAE;gBACP,IAAI,CAAC,EAAE;oBACN,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;iBACzB,CAAA;aACD,CAAA;SACD,CAAA;KACD,CAAA;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAChC,OAAO,CAAC,EAAE;YACT,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;YAC9B,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;YACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;SACxC,CAAA;KACD,CAAA;IACD,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA"}
1
+ {"version":3,"file":"vis_context.types.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACtB,CAAC,WAAW,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,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;YACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;SACxC,CAAA;KACD,CAAA;IACD,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Visual test configuration on the client side.
3
3
  */
4
- export declare const vis: import("./create_vis.ts").VisClientConfigurator<import("../index.ts").SnapshotMeta<import("../index.ts").ComparisonMethod>>;
4
+ export declare const vis: import("./create_vis.ts").VisClientConfigurator<import("../client.ts").SnapshotMeta<import("../client.ts").ComparisonMethod>>;
5
5
  //# sourceMappingURL=vis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vis.d.ts","sourceRoot":"","sources":["../../src/setup/vis.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,GAAG,6HAAsB,CAAA"}
1
+ {"version":3,"file":"vis.d.ts","sourceRoot":"","sources":["../../src/setup/vis.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,GAAG,+HAAsB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-plugin-vis",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Vitest visual testing plugin",
5
5
  "keywords": [
6
6
  "image-snapshot",
@@ -58,6 +58,9 @@
58
58
  },
59
59
  "./package.json": "./package.json"
60
60
  },
61
+ "imports": {
62
+ "#vitest-plugin-vis/config": "./src/config.ts"
63
+ },
61
64
  "types": "./esm/index.d.ts",
62
65
  "files": [
63
66
  "esm",
@@ -80,10 +83,10 @@
80
83
  "@types/is-ci": "^3.0.4",
81
84
  "@types/pngjs": "^6.0.5",
82
85
  "@types/react": "^19.0.2",
83
- "@vitest/browser": "^3.0.6",
84
- "@vitest/coverage-istanbul": "^3.0.6",
85
- "@vitest/coverage-v8": "^3.0.6",
86
- "@vitest/expect": "^3.0.6",
86
+ "@vitest/browser": "^3.0.8",
87
+ "@vitest/coverage-istanbul": "^3.0.8",
88
+ "@vitest/coverage-v8": "^3.0.8",
89
+ "@vitest/expect": "^3.0.8",
87
90
  "cross-env": "^7.0.3",
88
91
  "never-fail": "^1.1.4",
89
92
  "npm-run-all2": "^7.0.2",
@@ -92,9 +95,8 @@
92
95
  "react-dom": "^19.0.0",
93
96
  "typescript": "^5.7.2",
94
97
  "vite": "^6.0.9",
95
- "vitest": "^3.0.6",
96
- "vitest-browser-react": "^0.1.0",
97
- "webdriverio": "latest"
98
+ "vitest": "^3.0.8",
99
+ "vitest-browser-react": "^0.1.0"
98
100
  },
99
101
  "peerDependencies": {
100
102
  "@vitest/browser": "^2 || ^3",
@@ -24,24 +24,24 @@ export function createVisContext() {
24
24
  state = {}
25
25
  },
26
26
  __test__getState(context: PartialBrowserCommandContext) {
27
- const projectRoot = getProjectRoot(context)
28
- return state[projectRoot]!
27
+ return state[getProjectId(context)]!
29
28
  },
30
29
  /**
31
30
  * Setup suite is called on each test file's beforeAll hook.
32
31
  * Test files include vitest test files and storybook story files.
33
32
  * It needs to make sure there is no race condition between the test files.
34
33
  */
35
- async setupSuite(context: PartialBrowserCommandContext) {
36
- const projectRoot = getProjectRoot(context)
34
+ async setupSuite(browserContext: PartialBrowserCommandContext) {
35
+ const projectId = getProjectId(browserContext)
37
36
 
38
- if (!state[projectRoot]) {
39
- state[projectRoot] = setupState(context, getVisOptions(visOptionsRecord, context) ?? {})
37
+ const visOptions = getVisOptions(visOptionsRecord, browserContext)
38
+ if (!state[projectId]) {
39
+ state[projectId] = setupState(browserContext, visOptions)
40
40
  }
41
41
 
42
- const projectState = await state[projectRoot]
42
+ const projectState = await state[projectId]
43
43
 
44
- const { suiteId, suite } = createSuite(projectState, context.testPath, visOptionsRecord)
44
+ const { suiteId, suite } = createSuite(projectState, browserContext.testPath, visOptions)
45
45
  projectState.suites[suiteId] = suite
46
46
 
47
47
  await Promise.allSettled([ctx.rimraf(suite.diffDir), ctx.rimraf(suite.resultDir)])
@@ -117,14 +117,14 @@ export function createVisContext() {
117
117
  })}.png`
118
118
  },
119
119
  async getSuiteInfo(browserContext: PartialBrowserCommandContext, taskId: string) {
120
- const projectRoot = getProjectRoot(browserContext)
121
- const projectState = await state[projectRoot]!
122
-
123
- const suiteId = getSuiteId(projectState, browserContext.testPath, visOptionsRecord)
120
+ const projectId = getProjectId(browserContext)
121
+ const projectState = await state[projectId]!
122
+ const visOptions = getVisOptions(visOptionsRecord, browserContext)
123
+ const suiteId = getSuiteId(projectState, browserContext.testPath, visOptions)
124
124
  const suite = projectState.suites[suiteId]!
125
125
  const task = (suite.tasks[taskId] = suite.tasks[taskId] ?? { count: 1 })
126
126
  return {
127
- projectRoot,
127
+ projectRoot: projectState.projectRoot,
128
128
  suiteId,
129
129
  taskId,
130
130
  baselineDir: suite.baselineDir,
@@ -186,9 +186,13 @@ export function getSuiteId(
186
186
  }
187
187
 
188
188
  function getVisOptions(visOptionsRecord: Record<string, VisOptions<any>>, context: PartialBrowserCommandContext) {
189
- return visOptionsRecord[getProjectName(context) ?? '__default']!
189
+ return visOptionsRecord[getProjectName(context) ?? '__default'] ?? {}
190
190
  }
191
191
 
192
192
  function getProjectRoot(context: PartialBrowserCommandContext) {
193
193
  return context.project.config.root
194
194
  }
195
+
196
+ function getProjectId(context: PartialBrowserCommandContext) {
197
+ return `${context.project.config.root}/${context.project.config.name}`
198
+ }
@@ -31,6 +31,7 @@ export type VisProjectState = {
31
31
  export type PartialBrowserCommandContext = {
32
32
  project: {
33
33
  config: {
34
+ name: string
34
35
  root: string
35
36
  snapshotOptions: {
36
37
  updateSnapshot: 'all' | 'new' | 'none'