vitest-plugin-vis 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ export declare function vis<M extends ComparisonMethod = 'pixel'>(options?: VisO
21
21
  writeImageSnapshot: import("vitest/node").BrowserCommand<[relativeFilePath: string, imageBase64: string]>;
22
22
  };
23
23
  };
24
- setupFiles: string[] | undefined;
24
+ setupFiles: string[];
25
25
  };
26
26
  };
27
27
  };
package/esm/config/vis.js CHANGED
@@ -19,7 +19,7 @@ export function vis(options = { preset: 'auto' }) {
19
19
  name: undefined,
20
20
  commands,
21
21
  },
22
- setupFiles: preset && preset !== 'none' ? [`vitest-plugin-vis/presets/${preset}`] : undefined,
22
+ setupFiles: preset && preset !== 'none' ? [`vitest-plugin-vis/presets/${preset}`] : [],
23
23
  },
24
24
  };
25
25
  },
@@ -21,7 +21,15 @@ export declare const visContext: {
21
21
  diffPath: string;
22
22
  timeout?: number | undefined | undefined;
23
23
  comparisonMethod?: any;
24
- diffOptions?: import("pixelmatch").PixelmatchOptions | undefined;
24
+ diffOptions?: {
25
+ threshold?: number | undefined;
26
+ includeAA?: boolean | undefined;
27
+ alpha?: number | undefined;
28
+ aaColor?: [number, number, number] | undefined;
29
+ diffColor?: [number, number, number] | undefined;
30
+ diffColorAlt?: [number, number, number] | undefined;
31
+ diffMask?: boolean | undefined;
32
+ } | undefined;
25
33
  failureThresholdType?: "pixel" | "percent" | undefined | undefined;
26
34
  failureThreshold?: number | undefined | undefined;
27
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vis_context.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;sBAC69C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADz8C,CAAA"}
1
+ {"version":3,"file":"vis_context.d.ts","sourceRoot":"","sources":["../../src/server/vis_context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;sBAC69C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADz8C,CAAA"}
@@ -28,7 +28,15 @@ export declare function createVisContext(): {
28
28
  diffPath: string;
29
29
  timeout?: number | undefined | undefined;
30
30
  comparisonMethod?: any;
31
- diffOptions?: import("pixelmatch").PixelmatchOptions | undefined;
31
+ diffOptions?: {
32
+ threshold?: number | undefined;
33
+ includeAA?: boolean | undefined;
34
+ alpha?: number | undefined;
35
+ aaColor?: [number, number, number] | undefined;
36
+ diffColor?: [number, number, number] | undefined;
37
+ diffColorAlt?: [number, number, number] | undefined;
38
+ diffMask?: boolean | undefined;
39
+ } | undefined;
32
40
  failureThresholdType?: "pixel" | "percent" | undefined | undefined;
33
41
  failureThreshold?: number | undefined | undefined;
34
42
  };
@@ -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;AAKpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEpF,wBAAgB,gBAAgB;eAMnB,CAAC,SAAS,OAAO,GAAG,MAAM,YAAW,UAAU,CAAC,CAAC,CAAC;;;;IAY7D;;;;OAIG;wBACuB,4BAA4B;8BAa5B,MAAM,QAAQ,MAAM,YAAY;QAAE,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;;;;;;;;;;;;;;;;;;;2BAkB1E,MAAM,UAAU,MAAM;+BAGlB,MAAM,UAAU,MAAM,kBAAkB,MAAM,GAAG,SAAS;8BAI3D;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,kBAAkB,MAAM,GAAG,SAAS;2BASlF,MAAM,UAA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M,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC,UAElH"}
@@ -1,4 +1,4 @@
1
- import type { PixelmatchOptions } from 'pixelmatch';
1
+ import type pixelMatch from 'pixelmatch';
2
2
  import type { Options as SsimOptions } from 'ssim.js';
3
3
  export interface ImageSnapshotTimeoutOptions {
4
4
  /**
@@ -47,7 +47,7 @@ export type PixelComparisonOptions<M = 'pixel'> = {
47
47
  /**
48
48
  * Custom options passed to 'pixelmatch'
49
49
  */
50
- diffOptions?: PixelmatchOptions | undefined;
50
+ diffOptions?: Parameters<typeof pixelMatch>[5] | undefined;
51
51
  };
52
52
  export type ImageSnapshotCompareOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim' ? SsimComparisonOptions<M> : PixelComparisonOptions<M>) & FailureThresholdOptions;
53
53
  export type AutoSnapshotOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,SAAS,CAAA;AAErD,MAAM,WAAW,2BAA2B;IAC3C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACtC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE;QAC/B,EAAE,EAAE,MAAM,CAAA;QAGV,KAAK,EAAE,MAAM,CAAA;KACb,KAAK,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/C,MAAM,MAAM,uBAAuB,GAAG;IACrC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IACtD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAA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rC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IACtD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,MAAM,IAAI;IAC/C,gBAAgB,EAAE,CAAC,CAAA;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;CAC9C,CAAA;AACD,MAAM,MAAM,sBAAsB,CAAC,CAAC,GAAG,OAAO,IAAI;IACjD,gBAAgB,CAAC,EAAE,CAAC,GAAG,SAAS,CAAA;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CAC1D,CAAA;AAED,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,IAAI,CAAC,CAAC,SAAS,MAAM,GAC9F,qBAAqB,CAAC,CAAC,CAAC,GACxB,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAC5B,uBAAuB,CAAA;AAExB,MAAM,MAAM,mBAAmB,GAAG;IACjC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-plugin-vis",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Vitest visual testing plugin",
5
5
  "keywords": [
6
6
  "image-snapshot",
@@ -61,16 +61,15 @@
61
61
  "!**/*.{spec,test,unit,accept,integrate,system,perf,stress}.*"
62
62
  ],
63
63
  "dependencies": {
64
- "@types/pixelmatch": "^5.2.6",
65
64
  "dedent": "^1.5.1",
66
65
  "is-ci": "^4.0.0",
67
66
  "mkdirp": "^3.0.1",
68
67
  "pathe": "^2.0.0",
69
- "pixelmatch": "^6.0.0",
68
+ "pixelmatch": "^7.1.0",
70
69
  "pngjs": "^7.0.0",
71
70
  "rimraf": "^6.0.1",
72
71
  "ssim.js": "^3.5.0",
73
- "type-plus": "^8.0.0-beta.6"
72
+ "type-plus": "8.0.0-beta.7"
74
73
  },
75
74
  "devDependencies": {
76
75
  "@repobuddy/typescript": "^2.1.0",
@@ -90,7 +89,7 @@
90
89
  "typescript": "^5.7.2",
91
90
  "vite": "^6.0.9",
92
91
  "vitest": "^3.0.5",
93
- "vitest-browser-react": "^0.0.4",
92
+ "vitest-browser-react": "^0.1.0",
94
93
  "webdriverio": "latest"
95
94
  },
96
95
  "peerDependencies": {
package/src/config/vis.ts CHANGED
@@ -23,7 +23,7 @@ export function vis<M extends ComparisonMethod = 'pixel'>(options: VisOptions<M>
23
23
  name: undefined as unknown as string,
24
24
  commands,
25
25
  },
26
- setupFiles: preset && preset !== 'none' ? [`vitest-plugin-vis/presets/${preset}`] : undefined,
26
+ setupFiles: preset && preset !== 'none' ? [`vitest-plugin-vis/presets/${preset}`] : [],
27
27
  },
28
28
  }
29
29
  },
@@ -1,4 +1,4 @@
1
- import type { PixelmatchOptions } from 'pixelmatch'
1
+ import type pixelMatch from 'pixelmatch'
2
2
  import type { Options as SsimOptions } from 'ssim.js'
3
3
 
4
4
  export interface ImageSnapshotTimeoutOptions {
@@ -54,7 +54,7 @@ export type PixelComparisonOptions<M = 'pixel'> = {
54
54
  /**
55
55
  * Custom options passed to 'pixelmatch'
56
56
  */
57
- diffOptions?: PixelmatchOptions | undefined
57
+ diffOptions?: Parameters<typeof pixelMatch>[5] | undefined
58
58
  }
59
59
 
60
60
  export type ImageSnapshotCompareOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim'