Skip to content

Commit 6109bd6

Browse files
authored
test(e2e-rspack): expand to 3-scenario matrix (legacy + modern, rspack 1 + 2) (#957)
Restores coverage that PR #806 dropped and adds a Rspack 1.x permutation. The e2e/rspack project now runs three scenarios sequentially: | Scenario | Rspack version | Griffel setup | | ----------------- | -------------- | ---------------------------------------------- | | legacy-rspack-1 | 1.7.11 (pin) | webpack-extraction-plugin + webpack-loader | | legacy-rspack-2 | workspace | webpack-extraction-plugin + webpack-loader | | modern-rspack-2 | workspace | webpack-plugin | Layout: - e2e/rspack/src/shared/src/ — single source tree used by every scenario (drops the fake-module / fake-colors alias indirection) - e2e/rspack/src/scenarios/<name>/rspack.config.js — per-scenario config - e2e/rspack/src/snapshots/<name>.css — per-scenario snapshot test.ts iterates a SCENARIOS array. rspackVersion is optional: only legacy-rspack-1 pins, the other two pick up @rspack/{cli,core} from workspace devDeps via the bare-name form of installPackages. compareSnapshots gains an `update` option so UPDATE_SNAPSHOTS=1 writes prettier-formatted output through the existing formatCSS helper instead of a raw copy. All three committed snapshots are byte-identical. Project wiring: - Add @griffel/{e2e-utils,react,webpack-{plugin,extraction-plugin,loader}} to e2e/rspack/package.json so lint's import-x rule is satisfied. - Add lint and build-cjs to the test target's dependsOn — covers core/react packages whose CJS bundle the e2e tarballs need. - implicitDependencies dropped: real package.json deps + dep graph cover it.
1 parent 175101f commit 6109bd6

14 files changed

Lines changed: 249 additions & 32 deletions

File tree

e2e/rspack/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
"name": "@griffel/e2e-rspack",
33
"version": "0.0.0",
44
"private": true,
5-
"type": "module"
5+
"type": "module",
6+
"dependencies": {
7+
"@griffel/e2e-utils": "*",
8+
"@griffel/react": "^1.7.2",
9+
"@griffel/webpack-extraction-plugin": "^0.5.17",
10+
"@griffel/webpack-loader": "^2.2.26",
11+
"@griffel/webpack-plugin": "^4.0.4"
12+
}
613
}

e2e/rspack/project.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"sourceRoot": "e2e/rspack/src",
55
"projectType": "library",
6-
"implicitDependencies": ["@griffel/webpack-plugin"],
76
"targets": {
87
"test": {
98
"executor": "nx:run-commands",
10-
"dependsOn": [{ "target": "build", "dependencies": true }],
9+
"dependsOn": [
10+
{ "target": "build", "dependencies": true },
11+
{ "target": "build-cjs", "dependencies": true }
12+
],
1113
"options": {
1214
"cwd": "e2e/rspack",
1315
"commands": [{ "command": "node src/test.ts" }]
@@ -21,6 +23,10 @@
2123
"commands": [{ "command": "tsc -b --pretty" }],
2224
"outputPath": []
2325
}
26+
},
27+
"lint": {
28+
"executor": "@nx/eslint:lint",
29+
"outputs": ["{options.outputFile}"]
2430
}
2531
},
2632
"tags": []
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// @ts-check
2+
3+
const { GriffelCSSExtractionPlugin } = require('@griffel/webpack-extraction-plugin');
4+
5+
/**
6+
* @type {import('@rspack/core').Configuration}
7+
*/
8+
const config = {
9+
mode: 'production',
10+
experiments: {
11+
css: true,
12+
},
13+
externals: {
14+
'@griffel/react': 'Griffel',
15+
},
16+
optimization: {
17+
minimize: false,
18+
},
19+
module: {
20+
rules: [
21+
{
22+
test: /\.js$/,
23+
exclude: /node_modules/,
24+
use: [{ loader: GriffelCSSExtractionPlugin.loader }, { loader: '@griffel/webpack-loader' }],
25+
},
26+
{
27+
test: /\.css$/,
28+
type: 'css',
29+
},
30+
],
31+
},
32+
plugins: [/** @type {any} */ (new GriffelCSSExtractionPlugin())],
33+
};
34+
35+
module.exports = config;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// @ts-check
2+
3+
const { GriffelCSSExtractionPlugin } = require('@griffel/webpack-extraction-plugin');
4+
5+
/**
6+
* @type {import('@rspack/core').Configuration}
7+
*/
8+
const config = {
9+
mode: 'production',
10+
experiments: {
11+
css: true,
12+
},
13+
externals: {
14+
'@griffel/react': 'Griffel',
15+
},
16+
optimization: {
17+
minimize: false,
18+
},
19+
module: {
20+
rules: [
21+
{
22+
test: /\.js$/,
23+
exclude: /node_modules/,
24+
use: [{ loader: GriffelCSSExtractionPlugin.loader }, { loader: '@griffel/webpack-loader' }],
25+
},
26+
{
27+
test: /\.css$/,
28+
type: 'css',
29+
},
30+
],
31+
},
32+
plugins: [/** @type {any} */ (new GriffelCSSExtractionPlugin())],
33+
};
34+
35+
module.exports = config;
File renamed without changes.
File renamed without changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.rddpni4 {
2+
display: flex;
3+
flex-direction: column;
4+
width: 200px;
5+
}
6+
.frolweh {
7+
border: 2px dashed magenta;
8+
}
9+
.f4khpsj {
10+
border-radius: 5px;
11+
}
12+
.f165xgdd {
13+
gap: 5px;
14+
}
15+
.fbhmu18 {
16+
padding: 10px;
17+
}
18+
.f1bh81bl {
19+
background-color: blue;
20+
}
21+
.fe3e8s9 {
22+
color: red;
23+
}
24+
.f1ir1d6m:focus {
25+
outline-offset: 5px;
26+
}
27+
@media (min-width: 968px) and (orientation: landscape) {
28+
.f1tnsuik {
29+
width: 400px;
30+
}
31+
}

0 commit comments

Comments
 (0)