storybook-addon-vis 0.0.5 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-addon-vis",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Storybook Vitest Image Snapshot addon",
5
5
  "keywords": [
6
6
  "image-snapshot",
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
- // import { expect } from '@storybook/test'
2
+ import { expect } from '@storybook/test'
3
3
  import dedent from 'dedent'
4
4
  import { page } from './@vitest/browser/context'
5
5
  import { UNI_PNG_URL } from './testing/constants'
@@ -27,13 +27,13 @@ export const Failed: StoryObj = {
27
27
  )
28
28
  },
29
29
  async play() {
30
- await expect(() => expect(page.imageSnapshot()).toMatchImageSnapshot()).rejects.toThrowError(
31
- dedent`Expected image to match but was differ by 5105 pixels.
30
+ await expect(() => expect(page.imageSnapshot()).toMatchImageSnapshot()).rejects.toMatchObject({
31
+ message: dedent`Expected image to match but was differ by 5105 pixels.
32
32
 
33
33
  Expected: '../__snapshots__/expect.to_match_image_snapshot.stories.tsx/failed-1.png'
34
34
  Actual: '../__snapshots__/__results__/expect.to_match_image_snapshot.stories.tsx/failed-1.png'
35
35
  Difference: '../__snapshots__/__diff_output__/expect.to_match_image_snapshot.stories.tsx/failed-1.png'`,
36
- )
36
+ })
37
37
  },
38
38
  }
39
39
 
@@ -54,13 +54,13 @@ export const DifferentSize: StoryObj = {
54
54
  },
55
55
  async play({ canvas }) {
56
56
  const image = await canvas.getByRole('img')
57
- await expect(() => expect(page.imageSnapshot({ element: image })).toMatchImageSnapshot()).rejects.toThrowError(
58
- dedent`Expected image to match but was differ by 51931 pixels.
57
+ await expect(() => expect(page.imageSnapshot({ element: image })).toMatchImageSnapshot()).rejects.toMatchObject({
58
+ message: dedent`Expected image to match but was differ by 51931 pixels.
59
59
 
60
60
  Expected: '../__snapshots__/expect.to_match_image_snapshot.stories.tsx/different-size-1.png'
61
61
  Actual: '../__snapshots__/__results__/expect.to_match_image_snapshot.stories.tsx/different-size-1.png'
62
62
  Difference: '../__snapshots__/__diff_output__/expect.to_match_image_snapshot.stories.tsx/different-size-1.png'`,
63
- )
63
+ })
64
64
  },
65
65
  }
66
66
 
@@ -84,13 +84,13 @@ export const FailureThreshold: StoryObj = {
84
84
  expect(page.imageSnapshot({ element: subject })).toMatchImageSnapshot({
85
85
  failureThreshold: 10,
86
86
  }),
87
- ).rejects.toThrowError(
88
- dedent`Expected image to match within 10 pixels but was differ by 60 pixels.
87
+ ).rejects.toMatchObject({
88
+ message: dedent`Expected image to match within 10 pixels but was differ by 60 pixels.
89
89
 
90
90
  Expected: '../__snapshots__/expect.to_match_image_snapshot.stories.tsx/failure-threshold-1.png'
91
91
  Actual: '../__snapshots__/__results__/expect.to_match_image_snapshot.stories.tsx/failure-threshold-1.png'
92
92
  Difference: '../__snapshots__/__diff_output__/expect.to_match_image_snapshot.stories.tsx/failure-threshold-1.png'`,
93
- )
93
+ })
94
94
  },
95
95
  }
96
96
 
@@ -104,13 +104,13 @@ export const FailureThresholdByPercentage: StoryObj = {
104
104
  failureThreshold: 0.1,
105
105
  failureThresholdType: 'percent',
106
106
  }),
107
- ).rejects.toThrowError(
108
- dedent`Expected image to match within 0.1% but was differ by 0.2777777777777778%.
107
+ ).rejects.toMatchObject({
108
+ message: dedent`Expected image to match within 0.1% but was differ by 0.2777777777777778%.
109
109
 
110
110
  Expected: '../__snapshots__/expect.to_match_image_snapshot.stories.tsx/failure-threshold-by-percentage-1.png'
111
111
  Actual: '../__snapshots__/__results__/expect.to_match_image_snapshot.stories.tsx/failure-threshold-by-percentage-1.png'
112
112
  Difference: '../__snapshots__/__diff_output__/expect.to_match_image_snapshot.stories.tsx/failure-threshold-by-percentage-1.png'`,
113
- )
113
+ })
114
114
  },
115
115
  }
116
116
 
@@ -135,12 +135,12 @@ export const ExactFailureThresholdByPercentage: StoryObj = {
135
135
  expect(page.imageSnapshot({ element: subject })).toMatchImageSnapshot({
136
136
  failureThresholdType: 'percent',
137
137
  }),
138
- ).rejects.toThrowError(
139
- dedent`Expected image to match but was differ by 0.2777777777777778%.
138
+ ).rejects.toMatchObject({
139
+ message: dedent`Expected image to match but was differ by 0.2777777777777778%.
140
140
 
141
141
  Expected: '../__snapshots__/expect.to_match_image_snapshot.stories.tsx/exact-failure-threshold-by-percentage-1.png'
142
142
  Actual: '../__snapshots__/__results__/expect.to_match_image_snapshot.stories.tsx/exact-failure-threshold-by-percentage-1.png'
143
143
  Difference: '../__snapshots__/__diff_output__/expect.to_match_image_snapshot.stories.tsx/exact-failure-threshold-by-percentage-1.png'`,
144
- )
144
+ })
145
145
  },
146
146
  }