vitest-image-snapshot 0.6.15 → 0.6.16

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/README.md CHANGED
@@ -175,12 +175,12 @@ interface MatchImageOptions {
175
175
 
176
176
  ```typescript
177
177
  import { imageMatcher } from "vitest-image-snapshot";
178
- import { testFragmentShaderImage } from "wesl-debug";
178
+ import { testFragmentImage } from "wesl-test";
179
179
 
180
180
  imageMatcher();
181
181
 
182
182
  test("shader output matches snapshot", async () => {
183
- const result = await testFragmentShaderImage({
183
+ const result = await testFragmentImage({
184
184
  projectDir: import.meta.url,
185
185
  device,
186
186
  src: `@fragment fn fs_main() -> @location(0) vec4f { return vec4f(1.0, 0.0, 0.0, 1.0); }`,
package/dist/index.d.ts CHANGED
@@ -109,4 +109,11 @@ declare class ImageSnapshotManager {
109
109
  private saveToPath;
110
110
  }
111
111
  //#endregion
112
+ //#region src/index.d.ts
113
+ declare module "vitest" {
114
+ interface Matchers<T = any> {
115
+ toMatchImage(nameOrOptions?: string | MatchImageOptions): Promise<void>;
116
+ }
117
+ }
118
+ //#endregion
112
119
  export { ComparisonOptions, ComparisonResult, DiffReportConfig, ImageData, ImageSnapshotFailure, ImageSnapshotManager, ImageSnapshotReporter, ImageSnapshotReporterOptions, MatchImageOptions, SnapshotConfig, compareImages, generateDiffReport, imageMatcher, pngBuffer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-image-snapshot",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,4 +1,3 @@
1
- /// <reference types="./vitest.d.ts" />
2
1
  import { expect } from "vitest";
3
2
  import { getCurrentTest } from "vitest/suite";
4
3
  import {
@@ -81,6 +80,7 @@ async function toMatchImage(
81
80
  if (!comparison.pass) {
82
81
  const currentTest = getCurrentTest();
83
82
  if (currentTest) {
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
84
  (currentTest.meta as any).imageSnapshotFailure = {
85
85
  actualPath: manager.actualPath(snapshotName),
86
86
  expectedPath: manager.referencePath(snapshotName),
@@ -1,7 +1,15 @@
1
1
  import * as path from "node:path";
2
2
  import type { Reporter, TestCase, Vitest } from "vitest/node";
3
3
  import { generateDiffReport, type ImageSnapshotFailure } from "./DiffReport.ts";
4
- import type { ImageSnapshotFailureData } from "./vitest.d.ts";
4
+
5
+ /** metadata saved at failure for future report */
6
+ interface ImageSnapshotFailureData {
7
+ actualPath: string;
8
+ expectedPath: string;
9
+ diffPath: string;
10
+ mismatchedPixels: number;
11
+ mismatchedPixelRatio: number;
12
+ }
5
13
 
6
14
  export interface ImageSnapshotReporterOptions {
7
15
  /** Report directory (relative to config.root or absolute) */
package/src/index.ts CHANGED
@@ -1,8 +1,18 @@
1
- /// <reference types="./vitest.ts" />
2
-
1
+ /* oxlint-disable no-unused-vars */
3
2
  export * from "./DiffReport.ts";
4
3
  export * from "./ImageComparison.ts";
5
4
  export * from "./ImageSnapshotMatcher.ts";
6
5
  export * from "./ImageSnapshotReporter.ts";
7
6
  export * from "./PNGUtil.ts";
8
7
  export * from "./SnapshotManager.ts";
8
+
9
+ import type {} from "vitest";
10
+ import type { MatchImageOptions } from "./ImageSnapshotMatcher.ts";
11
+
12
+ // Module augmentation for Vitest 3.2+ - automatically applied when this package is imported
13
+ declare module "vitest" {
14
+ // biome-ignore lint/correctness/noUnusedVariables: T must match Vitest's Matchers<T> signature
15
+ interface Matchers<T = any> {
16
+ toMatchImage(nameOrOptions?: string | MatchImageOptions): Promise<void>;
17
+ }
18
+ }
@@ -128,7 +128,7 @@
128
128
  <h1>🔴 Image Snapshot Failures</h1>
129
129
  <div class="meta">
130
130
  <strong>1</strong> test failed •
131
- Generated: 10/23/2025, 9:33:37 PM
131
+ Generated: 10/29/2025, 12:57:43 PM
132
132
  </div>
133
133
  <div class="update-hint">
134
134
  💡 <strong>To update snapshots:</strong> Run <code>pnpm test -- -u</code> or <code>vitest -u</code>
package/src/vitest.d.ts DELETED
@@ -1,25 +0,0 @@
1
- import type { MatchImageOptions } from "./ImageSnapshotMatcher.ts";
2
-
3
- export interface ImageSnapshotFailureData {
4
- actualPath: string;
5
- expectedPath: string;
6
- diffPath: string;
7
- mismatchedPixels: number;
8
- mismatchedPixelRatio: number;
9
- }
10
-
11
- declare module "vitest" {
12
- interface Assertion<_T = unknown> {
13
- toMatchImage(nameOrOptions?: string | MatchImageOptions): Promise<void>;
14
- }
15
- interface AsymmetricMatchersContaining {
16
- toMatchImage(nameOrOptions?: string | MatchImageOptions): Promise<void>;
17
- }
18
- }
19
-
20
- declare module "@vitest/runner" {
21
- interface TaskMeta {
22
- /** Image snapshot failure data (set by toMatchImage matcher) */
23
- imageSnapshotFailure?: ImageSnapshotFailureData;
24
- }
25
- }