vitest-plugin-vis 1.6.0 → 1.6.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"create_vis.d.ts","sourceRoot":"","sources":["../../src/setup/create_vis.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAEjF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,oBAAoB;;QAOrD;;WAEG;;QAIH;;;;WAIG;;QAKH;;;;;;;;;;;;;;WAcG;sBACW,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;;;;;;;8BAiBlC,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;;EAoClE"}
1
+ {"version":3,"file":"create_vis.d.ts","sourceRoot":"","sources":["../../src/setup/create_vis.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAEjF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,oBAAoB;;QAOrD;;WAEG;;QAIH;;;;WAIG;;QAKH;;;;;;;;;;;;;;WAcG;sBACW,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;;;;;;;8BAoBlC,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;;EAsClE"}
@@ -53,7 +53,10 @@ export function createVis(commands) {
53
53
  },
54
54
  afterEach: {
55
55
  async matchImageSnapshot() {
56
- const meta = getAutoSnapshotOptions(ctx.getCurrentTest());
56
+ const test = ctx.getCurrentTest();
57
+ if ((test?.result?.errors?.length ?? 0) > 0)
58
+ return;
59
+ const meta = getAutoSnapshotOptions(test);
57
60
  if (!shouldTakeSnapshot(meta))
58
61
  return;
59
62
  await expect(getSubject(meta?.subjectDataTestId ?? subjectDataTestId)).toMatchImageSnapshot(meta);
@@ -61,13 +64,15 @@ export function createVis(commands) {
61
64
  matchPerTheme(themes) {
62
65
  return async function matchImageSnapshot() {
63
66
  const test = ctx.getCurrentTest();
67
+ if ((test?.result?.errors?.length ?? 0) > 0)
68
+ return;
64
69
  const meta = getAutoSnapshotOptions(test);
65
70
  if (!shouldTakeSnapshot(meta))
66
71
  return;
67
72
  const errors = [];
68
73
  for (const themeId in themes) {
69
74
  try {
70
- await themes[themeId]();
75
+ await new Promise((a) => setTimeout(() => a(themes[themeId]()), 10));
71
76
  await expect(getSubject(meta?.subjectDataTestId ?? subjectDataTestId)).toMatchImageSnapshot({
72
77
  ...meta,
73
78
  customizeSnapshotId: (id) => `${id}-${themeId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-plugin-vis",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Vitest visual testing plugin",
5
5
  "keywords": [
6
6
  "image-snapshot",
@@ -55,7 +55,10 @@ export function createVis(commands: SetupVisSuiteCommand) {
55
55
  },
56
56
  afterEach: {
57
57
  async matchImageSnapshot() {
58
- const meta = getAutoSnapshotOptions(ctx.getCurrentTest())
58
+ const test = ctx.getCurrentTest()
59
+ if ((test?.result?.errors?.length ?? 0) > 0) return
60
+
61
+ const meta = getAutoSnapshotOptions(test)
59
62
  if (!shouldTakeSnapshot(meta)) return
60
63
 
61
64
  await expect(getSubject(meta?.subjectDataTestId ?? subjectDataTestId)).toMatchImageSnapshot(meta)
@@ -63,12 +66,14 @@ export function createVis(commands: SetupVisSuiteCommand) {
63
66
  matchPerTheme(themes: Record<string, () => Promise<void> | void>) {
64
67
  return async function matchImageSnapshot() {
65
68
  const test = ctx.getCurrentTest()
69
+ if ((test?.result?.errors?.length ?? 0) > 0) return
70
+
66
71
  const meta = getAutoSnapshotOptions(test)
67
72
  if (!shouldTakeSnapshot(meta)) return
68
73
  const errors: any[] = []
69
74
  for (const themeId in themes) {
70
75
  try {
71
- await themes[themeId]!()
76
+ await new Promise((a) => setTimeout(() => a(themes[themeId]!()), 10))
72
77
  await expect(getSubject(meta?.subjectDataTestId ?? subjectDataTestId)).toMatchImageSnapshot({
73
78
  ...meta,
74
79
  customizeSnapshotId: (id) => `${id}-${themeId}`,