Skip to content

Commit 3a2429c

Browse files
authored
Don't minify CSS in e2e test snapshots (#1259)
1 parent ef8174e commit 3a2429c

33 files changed

+164
-172
lines changed

.github/workflows/validate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
uses: actions/setup-node@main
8484
with:
8585
node-version-file: '.nvmrc'
86+
cache: 'pnpm'
8687

8788
- name: Install Dependencies
8889
run: pnpm i

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@changesets/changelog-github": "^0.4.8",
3333
"@changesets/cli": "^2.26.2",
3434
"@manypkg/cli": "^0.19.1",
35-
"@playwright/test": "^1.25.1",
35+
"@playwright/test": "^1.40.1",
3636
"@preconstruct/cli": "^2.0.1",
3737
"@swc/core": "^1.2.112",
3838
"@testing-library/jest-dom": "^5.11.9",

pnpm-lock.yaml

Lines changed: 21 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test-helpers/src/getStylesheet.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export const stylesheetName = 'main.css';
88

99
export async function getStylesheet(url: string, stylesheetName = 'main.css') {
1010
const response = await got(`${url}/${stylesheetName}`);
11+
// Just remove comments and normalize whitespace
12+
// https://cssnano.co/docs/what-are-optimisations/#what-optimisations-do-you-support%3F
1113
const { css } = await postcss([cssnano({ preset: litePreset() })]).process(
1214
response.body,
1315
{

test-helpers/src/startFixture/esbuild.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ export const startEsbuildFixture = async (
3636
metafile: true,
3737
platform: 'browser',
3838
bundle: true,
39-
minify: mode === 'production',
39+
minify: false,
4040
plugins: [
4141
plugin({
42+
identifiers: mode === 'production' ? 'short' : 'debug',
4243
runtime: type.includes('runtime'),
4344
}),
4445
],

test-helpers/src/startFixture/parcel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const startParcelFixture = async (
2828
},
2929
defaultTargetOptions: {
3030
distDir,
31+
shouldOptimize: false,
3132
},
3233
logLevel: 'verbose',
3334
});

test-helpers/src/startFixture/vite.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const startViteFixture = async (
4949
},
5050
build: {
5151
cssCodeSplit: false,
52+
minify: false,
5253
},
5354
};
5455

tests/e2e/features.playwright.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,7 @@ import {
66
} from '@vanilla-extract-private/test-helpers';
77

88
import test from './fixture';
9-
10-
const testCases = [
11-
{ type: 'mini-css-extract', mode: 'development', snapshotCss: true },
12-
{ type: 'mini-css-extract', mode: 'production', snapshotCss: true },
13-
{ type: 'style-loader', mode: 'development', snapshotCss: false },
14-
{ type: 'esbuild', mode: 'development', snapshotCss: true },
15-
{ type: 'esbuild', mode: 'production', snapshotCss: true },
16-
{ type: 'esbuild-runtime', mode: 'development', snapshotCss: false },
17-
{ type: 'esbuild-runtime', mode: 'production', snapshotCss: false },
18-
{ type: 'esbuild-next', mode: 'development', snapshotCss: true },
19-
{ type: 'esbuild-next', mode: 'production', snapshotCss: true },
20-
{ type: 'esbuild-next-runtime', mode: 'development', snapshotCss: false },
21-
{ type: 'esbuild-next-runtime', mode: 'production', snapshotCss: false },
22-
{ type: 'vite', mode: 'development', snapshotCss: false },
23-
{ type: 'vite', mode: 'production', snapshotCss: true },
24-
{ type: 'parcel', mode: 'development', snapshotCss: true },
25-
{ type: 'parcel', mode: 'production', snapshotCss: true },
26-
] as const;
9+
import { all as testCases } from './testCases';
2710

2811
testCases.forEach(({ type, mode, snapshotCss = true }) => {
2912
test.describe(`features - ${type} (${mode})`, () => {

tests/e2e/features.playwright.ts-snapshots/features-esbuild--production.css

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,37 @@
66
display: block;
77
}
88
._1o6ek501 {
9-
background-color: #b0e0e6;
9+
background-color: powderblue;
1010
}
1111
._1o6ek501:hover {
12-
background-color: #708090;
12+
background-color: slategray;
1313
}
1414
._1o6ek502 {
15-
background-color: #b0e0e6;
15+
background-color: powderblue;
1616
}
1717
._1o6ek502:hover {
18-
background-color: #708090;
18+
background-color: slategray;
1919
}
2020
._1o6ek503 {
21-
background-color: #b0e0e6;
21+
background-color: powderblue;
2222
}
2323
._1o6ek503:hover {
24-
background-color: #708090;
24+
background-color: slategray;
2525
}
2626
._1o6ek505 {
27-
color: #fff;
27+
color: white;
2828
}
2929
._1o6ek506 {
30-
background-color: #000;
30+
background-color: black;
3131
}
3232
body ._1o6ek507 {
3333
font-size: 24px;
3434
}
3535
._1o6ek508 {
36-
color: #fff;
36+
color: white;
3737
}
3838
._1o6ek509 {
39-
background-color: #000;
39+
background-color: black;
4040
}
4141
body ._1o6ek50a {
4242
font-size: 24px;

tests/e2e/features.playwright.ts-snapshots/features-esbuild-next--production.css

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,37 @@
66
display: block;
77
}
88
._1o6ek501 {
9-
background-color: #b0e0e6;
9+
background-color: powderblue;
1010
}
1111
._1o6ek501:hover {
12-
background-color: #708090;
12+
background-color: slategray;
1313
}
1414
._1o6ek502 {
15-
background-color: #b0e0e6;
15+
background-color: powderblue;
1616
}
1717
._1o6ek502:hover {
18-
background-color: #708090;
18+
background-color: slategray;
1919
}
2020
._1o6ek503 {
21-
background-color: #b0e0e6;
21+
background-color: powderblue;
2222
}
2323
._1o6ek503:hover {
24-
background-color: #708090;
24+
background-color: slategray;
2525
}
2626
._1o6ek505 {
27-
color: #fff;
27+
color: white;
2828
}
2929
._1o6ek506 {
30-
background-color: #000;
30+
background-color: black;
3131
}
3232
body ._1o6ek507 {
3333
font-size: 24px;
3434
}
3535
._1o6ek508 {
36-
color: #fff;
36+
color: white;
3737
}
3838
._1o6ek509 {
39-
background-color: #000;
39+
background-color: black;
4040
}
4141
body ._1o6ek50a {
4242
font-size: 24px;

0 commit comments

Comments
 (0)