Skip to content

Commit b5fa481

Browse files
committed
test: run prettier before checking snapshot for vite tests (avoid whitespace diff on windows)
1 parent 11f6b76 commit b5fa481

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

tests/vite/__snapshots__/v3.css

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
.h-4 {
2-
height: 1rem
2+
height: 1rem;
33
}
44
.w-4 {
5-
width: 1rem
5+
width: 1rem;
66
}
77
@layer icons.base {
8-
.ph {
9-
--ph-url: none;
10-
width: 1em;
11-
height: 1em;
12-
background-color: currentcolor;
13-
color: inherit;
14-
mask-image: var(--ph-url);
15-
mask-size: 100% 100%;
16-
mask-repeat: no-repeat
17-
}
18-
.ph:is(span,i) {
19-
display: inline-block
20-
}
8+
.ph {
9+
--ph-url: none;
10+
width: 1em;
11+
height: 1em;
12+
background-color: currentcolor;
13+
color: inherit;
14+
mask-image: var(--ph-url);
15+
mask-size: 100% 100%;
16+
mask-repeat: no-repeat;
17+
}
18+
.ph:is(span, i) {
19+
display: inline-block;
20+
}
2121
}
2222
@layer icons {
23-
.ph-\[info\] {
24-
--ph-url: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiBmaWxsPSJjdXJyZW50Q29sb3IiPjxwYXRoIGQ9Ik0xMjgsMjRBMTA0LDEwNCwwLDEsMCwyMzIsMTI4LDEwNC4xMSwxMDQuMTEsMCwwLDAsMTI4LDI0Wm0wLDE5MmE4OCw4OCwwLDEsMSw4OC04OEE4OC4xLDg4LjEsMCwwLDEsMTI4LDIxNlptMTYtNDBhOCw4LDAsMCwxLTgsOCwxNiwxNiwwLDAsMS0xNi0xNlYxMjhhOCw4LDAsMCwxLDAtMTYsMTYsMTYsMCwwLDEsMTYsMTZ2NDBBOCw4LDAsMCwxLDE0NCwxNzZaTTExMiw4NGExMiwxMiwwLDEsMSwxMiwxMkExMiwxMiwwLDAsMSwxMTIsODRaIi8+PC9zdmc+)
25-
}
23+
.ph-\[info\] {
24+
--ph-url: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiBmaWxsPSJjdXJyZW50Q29sb3IiPjxwYXRoIGQ9Ik0xMjgsMjRBMTA0LDEwNCwwLDEsMCwyMzIsMTI4LDEwNC4xMSwxMDQuMTEsMCwwLDAsMTI4LDI0Wm0wLDE5MmE4OCw4OCwwLDEsMSw4OC04OEE4OC4xLDg4LjEsMCwwLDEsMTI4LDIxNlptMTYtNDBhOCw4LDAsMCwxLTgsOCwxNiwxNiwwLDAsMS0xNi0xNlYxMjhhOCw4LDAsMCwxLDAtMTYsMTYsMTYsMCwwLDEsMTYsMTZ2NDBBOCw4LDAsMCwxLDE0NCwxNzZaTTExMiw4NGExMiwxMiwwLDEsMSwxMiwxMkExMiwxMiwwLDAsMSwxMTIsODRaIi8+PC9zdmc+);
25+
}
2626
}

tests/vite/__snapshots__/v4.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*! tailwindcss v4.0.0-beta.8 | MIT License | https://tailwindcss.com */
22
@base {
3-
:root { --spacing: .25rem; }
3+
:root {
4+
--spacing: 0.25rem;
5+
}
46
}
57

68
@layer utilities {

tests/vite/vite.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import path from 'path';
22

3+
import { format } from 'prettier';
34
import { build, Rollup } from 'vite';
45
import { test, expect } from 'vitest';
56

@@ -10,7 +11,7 @@ import { test, expect } from 'vitest';
1011
})) as Rollup.RollupOutput;
1112
const css = (output.find((c) => c.name === 'index.css') as Rollup.OutputAsset)?.source;
1213

13-
await expect(css).toMatchFileSnapshot(
14+
await expect(await format(css.toString(), { parser: 'css' })).toMatchFileSnapshot(
1415
path.resolve(import.meta.dirname, '__snapshots__', `${version}.css`),
1516
);
1617
});

0 commit comments

Comments
 (0)