@griddo/ax 12.2.2 → 12.2.3-rc.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.
- package/config/__tests__/webpack5-migration.test.js +436 -0
- package/config/webpack.config.js +180 -189
- package/config/webpackDevServer.config.js +63 -93
- package/config/webpackSchemas.config.js +6 -1
- package/package.json +20 -26
- package/scripts/build.js +4 -0
- package/scripts/start.js +38 -9
- package/src/modules/App/Routing/NavMenu/index.tsx +4 -2
- package/config/pnpTs.js +0 -15
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression guard for the webpack 4 -> 5 migration.
|
|
3
|
+
*
|
|
4
|
+
* These tests read the build config/scripts as text and assert the webpack 5
|
|
5
|
+
* patterns are present and the webpack 4 remnants are gone. They are intentionally
|
|
6
|
+
* coarse (string/regex checks) so they stay cheap and don't need to boot webpack.
|
|
7
|
+
*
|
|
8
|
+
* Scope decisions encoded here (see docs): PostCSS stays minimal
|
|
9
|
+
* (postcss-preset-env 6.x + postcss-normalize kept, only the loader API migrated),
|
|
10
|
+
* TypeScript stays 4.9.x, and workbox is removed (no service-worker source).
|
|
11
|
+
*/
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
|
|
15
|
+
const configDir = path.resolve(__dirname, "..");
|
|
16
|
+
const scriptsDir = path.resolve(__dirname, "../../scripts");
|
|
17
|
+
const pkgJsonPath = path.resolve(__dirname, "../../package.json");
|
|
18
|
+
|
|
19
|
+
const read = (filePath) => fs.readFileSync(filePath, "utf-8");
|
|
20
|
+
|
|
21
|
+
const webpackConfig = read(path.join(configDir, "webpack.config.js"));
|
|
22
|
+
const devServerConfig = read(path.join(configDir, "webpackDevServer.config.js"));
|
|
23
|
+
const startScript = read(path.join(scriptsDir, "start.js"));
|
|
24
|
+
const buildScript = read(path.join(scriptsDir, "build.js"));
|
|
25
|
+
const schemasConfig = read(path.join(configDir, "webpackSchemas.config.js"));
|
|
26
|
+
const syncSchemasScript = read(path.join(scriptsDir, "griddo-sync-schemas.js"));
|
|
27
|
+
const pkgJson = JSON.parse(read(pkgJsonPath));
|
|
28
|
+
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// 1. webpack.config.js — webpack 5 patterns present
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
describe("webpack.config.js — wp5 patterns", () => {
|
|
33
|
+
test("uses xxhash64 hash function (Node 17+ OpenSSL 3 compat)", () => {
|
|
34
|
+
expect(webpackConfig).toContain('hashFunction: "xxhash64"');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("uses chunkLoadingGlobal instead of jsonpFunction", () => {
|
|
38
|
+
expect(webpackConfig).toContain("chunkLoadingGlobal");
|
|
39
|
+
expect(webpackConfig).not.toContain("jsonpFunction");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("defines assetModuleFilename for asset modules", () => {
|
|
43
|
+
expect(webpackConfig).toContain("assetModuleFilename");
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("dev output filename uses [name].js (not bundle.js)", () => {
|
|
47
|
+
expect(webpackConfig).toContain("[name].js");
|
|
48
|
+
expect(webpackConfig).not.toMatch(/filename.*bundle\.js/);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("has filesystem cache block", () => {
|
|
52
|
+
expect(webpackConfig).toContain('type: "filesystem"');
|
|
53
|
+
expect(webpackConfig).toContain("cacheDirectory");
|
|
54
|
+
expect(webpackConfig).toContain("createEnvironmentHash");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("skips the filesystem cache and caps Terser workers on CI", () => {
|
|
58
|
+
// A resource-capped runner can't absorb a cache pack it never reuses, nor one
|
|
59
|
+
// Terser worker per host core (os.cpus() ignores the container's CPU quota).
|
|
60
|
+
expect(webpackConfig).toContain("cache: isCI");
|
|
61
|
+
expect(webpackConfig).toContain("parallel: isCI");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("uses CssMinimizerPlugin (not OptimizeCSSAssetsPlugin)", () => {
|
|
65
|
+
expect(webpackConfig).toContain("CssMinimizerPlugin");
|
|
66
|
+
expect(webpackConfig).not.toContain("OptimizeCSSAssetsPlugin");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("TerserPlugin does not set top-level sourceMap option", () => {
|
|
70
|
+
// In wp4 TerserPlugin had a `sourceMap` option at the top level.
|
|
71
|
+
// wp5 uses `devtool` instead. The word "sourceMap" may still appear
|
|
72
|
+
// inside terserOptions sub-objects — that's fine.
|
|
73
|
+
expect(webpackConfig).not.toMatch(/new TerserPlugin\(\{[^}]*sourceMap\s*:/);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("splitChunks does not use deprecated name option", () => {
|
|
77
|
+
const splitChunksBlock = webpackConfig.match(/splitChunks:\s*\{[\s\S]*?\},/);
|
|
78
|
+
expect(splitChunksBlock).not.toBeNull();
|
|
79
|
+
expect(splitChunksBlock[0]).not.toMatch(/name\s*:/);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("uses asset modules instead of url-loader and file-loader", () => {
|
|
83
|
+
expect(webpackConfig).toContain('type: "asset"');
|
|
84
|
+
expect(webpackConfig).toContain('type: "asset/resource"');
|
|
85
|
+
// Ensure no require/resolve references to the old loaders (comments are OK)
|
|
86
|
+
expect(webpackConfig).not.toMatch(/require\.resolve\(["']url-loader["']\)/);
|
|
87
|
+
expect(webpackConfig).not.toMatch(/require\.resolve\(["']file-loader["']\)/);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test("css-loader does not set esModule: false (breaks import * as styles)", () => {
|
|
91
|
+
// css-loader v6 with esModule: false + webpack 5 ESM namespace interop
|
|
92
|
+
// causes `import * as styles` to put the class map under .default, making
|
|
93
|
+
// styles.className === undefined. Instead, use namedExport: true.
|
|
94
|
+
expect(webpackConfig).not.toMatch(/css-loader[\s\S]*?esModule:\s*false/);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("CSS modules use namedExport: true for import * as compat", () => {
|
|
98
|
+
// griddo-components uses `import * as styles from "./x.module.css"` extensively
|
|
99
|
+
// and is compiled by this webpack config.
|
|
100
|
+
expect(webpackConfig).toContain("namedExport: true");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("CSS modules use exportLocalsConvention dashesOnly (not camelCaseOnly)", () => {
|
|
104
|
+
// camelCaseOnly converts @keyframes _in → export var in (reserved word!)
|
|
105
|
+
// dashesOnly only converts hyphens, keeping _in as _in (valid identifier)
|
|
106
|
+
expect(webpackConfig).toContain('exportLocalsConvention: "dashesOnly"');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("postcss-loader uses postcssOptions (not ident + plugins fn)", () => {
|
|
110
|
+
expect(webpackConfig).toContain("postcssOptions");
|
|
111
|
+
expect(webpackConfig).not.toMatch(/ident\s*:\s*["']postcss["']/);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("keeps postcssNormalize (postcss-preset-env 6 does not bundle normalize)", () => {
|
|
115
|
+
// Minimal PostCSS scope: preset-env stays at 6.x, which unlike 9 does not
|
|
116
|
+
// include normalize, so we keep calling postcssNormalize() explicitly.
|
|
117
|
+
expect(webpackConfig).toContain("postcssNormalize");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("does not use WorkboxWebpackPlugin (dead: no src/service-worker)", () => {
|
|
121
|
+
expect(webpackConfig).not.toContain("WorkboxWebpackPlugin");
|
|
122
|
+
expect(webpackConfig).not.toContain("workbox-webpack-plugin");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("resolve.fallback stubs server-only Node builtins (no browser equivalent)", () => {
|
|
126
|
+
expect(webpackConfig).toContain("fallback");
|
|
127
|
+
expect(webpackConfig).toMatch(/fs:\s*false/);
|
|
128
|
+
expect(webpackConfig).toMatch(/net:\s*false/);
|
|
129
|
+
expect(webpackConfig).toMatch(/tls:\s*false/);
|
|
130
|
+
expect(webpackConfig).toMatch(/child_process:\s*false/);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("uses NodePolyfillPlugin to restore webpack 4 browser polyfills for client builds", () => {
|
|
134
|
+
expect(webpackConfig).toContain("NodePolyfillPlugin");
|
|
135
|
+
expect(webpackConfig).toContain("node-polyfill-webpack-plugin");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("uses WebpackManifestPlugin (not bare ManifestPlugin)", () => {
|
|
139
|
+
expect(webpackConfig).toContain("WebpackManifestPlugin");
|
|
140
|
+
// Ensure there's no wp4-style `ManifestPlugin = require(...)` import
|
|
141
|
+
expect(webpackConfig).not.toMatch(/\bManifestPlugin\b(?!.*Webpack)/);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test("IgnorePlugin uses object syntax", () => {
|
|
145
|
+
expect(webpackConfig).toContain("resourceRegExp");
|
|
146
|
+
expect(webpackConfig).toContain("contextRegExp");
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("ForkTsCheckerWebpackPlugin uses v6+ API", () => {
|
|
150
|
+
// v6+ API uses `typescript` object with `typescriptPath`
|
|
151
|
+
expect(webpackConfig).toContain("typescriptPath");
|
|
152
|
+
expect(webpackConfig).toContain("diagnosticOptions");
|
|
153
|
+
// v4 API keys should be gone
|
|
154
|
+
expect(webpackConfig).not.toContain("checkSyntacticErrors");
|
|
155
|
+
expect(webpackConfig).not.toContain("resolveModuleNameModule");
|
|
156
|
+
expect(webpackConfig).not.toContain("resolveTypeReferenceDirectiveModule");
|
|
157
|
+
expect(webpackConfig).not.toContain("reportFiles");
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// 2. webpack.config.js — wp4 remnants must be absent
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
describe("webpack.config.js — no wp4 remnants", () => {
|
|
165
|
+
test("does not import pnp-webpack-plugin", () => {
|
|
166
|
+
expect(webpackConfig).not.toContain("pnp-webpack-plugin");
|
|
167
|
+
expect(webpackConfig).not.toContain("PnpWebpackPlugin");
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
test("does not use futureEmitAssets (default in wp5)", () => {
|
|
171
|
+
expect(webpackConfig).not.toContain("futureEmitAssets");
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test("does not have requireEnsure parser rule", () => {
|
|
175
|
+
expect(webpackConfig).not.toContain("requireEnsure");
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("does not use WatchMissingNodeModulesPlugin", () => {
|
|
179
|
+
expect(webpackConfig).not.toContain("WatchMissingNodeModulesPlugin");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("does not have node polyfills block", () => {
|
|
183
|
+
// wp4 had: node: { module: "empty", dgram: "empty", ... }
|
|
184
|
+
expect(webpackConfig).not.toMatch(/node\s*:\s*\{[\s\S]*?dgram/);
|
|
185
|
+
expect(webpackConfig).not.toMatch(/node\s*:\s*\{[\s\S]*?module.*empty/);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test("does not have resolveLoader PnP block", () => {
|
|
189
|
+
expect(webpackConfig).not.toContain("resolveLoader");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("does not import safePostCssParser", () => {
|
|
193
|
+
expect(webpackConfig).not.toContain("safePostCssParser");
|
|
194
|
+
expect(webpackConfig).not.toContain("postcss-safe-parser");
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// 3. webpackDevServer.config.js — WDS4 API
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
describe("webpackDevServer.config.js — WDS4 API", () => {
|
|
202
|
+
test("uses allowedHosts (not disableHostCheck)", () => {
|
|
203
|
+
expect(devServerConfig).toContain("allowedHosts");
|
|
204
|
+
expect(devServerConfig).not.toContain("disableHostCheck");
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test("uses WDS4 native client with a compile-error overlay", () => {
|
|
208
|
+
// The freeze bug came from CRA's react-error-overlay (now removed), not from
|
|
209
|
+
// WDS4's native overlay. We keep the compile-error overlay and disable the
|
|
210
|
+
// runtime-error one to avoid blocking the preview iframe.
|
|
211
|
+
expect(devServerConfig).toMatch(/client\s*:\s*\{/);
|
|
212
|
+
expect(devServerConfig).toMatch(/overlay\s*:\s*\{/);
|
|
213
|
+
expect(devServerConfig).toMatch(/errors\s*:\s*true/);
|
|
214
|
+
expect(devServerConfig).toMatch(/runtimeErrors\s*:\s*false/);
|
|
215
|
+
expect(devServerConfig).not.toContain("clientLogLevel");
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("wires WDS_SOCKET_* into client.webSocketURL (HMR behind a proxy)", () => {
|
|
219
|
+
// WDS3 read these via CRA's webpackHotDevClient (removed); WDS4 reads them
|
|
220
|
+
// from client.webSocketURL instead.
|
|
221
|
+
expect(devServerConfig).toContain("webSocketURL");
|
|
222
|
+
expect(devServerConfig).toContain("WDS_SOCKET_HOST");
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("uses static (not contentBase)", () => {
|
|
226
|
+
expect(devServerConfig).toMatch(/static\s*:\s*\{/);
|
|
227
|
+
expect(devServerConfig).not.toMatch(/contentBase\s*:/);
|
|
228
|
+
expect(devServerConfig).not.toContain("watchContentBase");
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test("uses webSocketServer: ws (not transportMode)", () => {
|
|
232
|
+
expect(devServerConfig).toMatch(/webSocketServer\s*:\s*["']ws["']/);
|
|
233
|
+
expect(devServerConfig).not.toContain("transportMode");
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("uses setupMiddlewares (not before/after)", () => {
|
|
237
|
+
expect(devServerConfig).toContain("setupMiddlewares");
|
|
238
|
+
// Ensure no WDS3-style before(app, server) or after(app) callbacks
|
|
239
|
+
expect(devServerConfig).not.toMatch(/\bbefore\s*\(\s*app/);
|
|
240
|
+
expect(devServerConfig).not.toMatch(/\bafter\s*\(\s*app/);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("uses devMiddleware (not publicPath at top level)", () => {
|
|
244
|
+
expect(devServerConfig).toMatch(/devMiddleware\s*:\s*\{/);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
test("setupMiddlewares uses unshift for pre-middlewares", () => {
|
|
248
|
+
expect(devServerConfig).toContain("middlewares.unshift");
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test("setupMiddlewares uses push for post-middlewares", () => {
|
|
252
|
+
expect(devServerConfig).toContain("middlewares.push");
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test("does not use devServer.app.use for post-middlewares", () => {
|
|
256
|
+
// devServer.app.use() runs BEFORE historyApiFallback — must not be used
|
|
257
|
+
// for redirectServedPath or noopServiceWorkerMiddleware
|
|
258
|
+
const setupBlock = devServerConfig.match(/setupMiddlewares[\s\S]*?return middlewares/);
|
|
259
|
+
expect(setupBlock).not.toBeNull();
|
|
260
|
+
expect(setupBlock[0]).not.toMatch(/devServer\.app\.use\([\s\S]*?redirectServedPath/);
|
|
261
|
+
expect(setupBlock[0]).not.toMatch(/devServer\.app\.use\([\s\S]*?noopServiceWorkerMiddleware/);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test("does not use errorOverlayMiddleware (handled by the WDS4/Fast Refresh overlay)", () => {
|
|
265
|
+
expect(devServerConfig).not.toContain("errorOverlayMiddleware");
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
test("does not use quiet or injectClient options", () => {
|
|
269
|
+
expect(devServerConfig).not.toMatch(/quiet\s*:/);
|
|
270
|
+
expect(devServerConfig).not.toMatch(/injectClient\s*:/);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test("hot is true (WDS4 manages HMR)", () => {
|
|
274
|
+
expect(devServerConfig).toMatch(/hot\s*:\s*true/);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
// 4. scripts/start.js — WDS4 constructor + startup API
|
|
280
|
+
// ---------------------------------------------------------------------------
|
|
281
|
+
describe("scripts/start.js — WDS4 API", () => {
|
|
282
|
+
test("WebpackDevServer constructor: config first, compiler second", () => {
|
|
283
|
+
// WDS4: new WebpackDevServer(config, compiler)
|
|
284
|
+
expect(startScript).toMatch(/new\s+WebpackDevServer\(\s*serverConfig\s*,\s*compiler\s*\)/);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
test("uses startCallback (not listen)", () => {
|
|
288
|
+
expect(startScript).toContain("startCallback");
|
|
289
|
+
expect(startScript).not.toMatch(/devServer\.listen\s*\(/);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
test("does not use devSocket (removed in WDS4)", () => {
|
|
293
|
+
expect(startScript).not.toContain("devSocket");
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("does not pass devSocket to createCompiler", () => {
|
|
297
|
+
const createCompilerBlock = startScript.match(/createCompiler\(\{[\s\S]*?\}\)/);
|
|
298
|
+
expect(createCompilerBlock).not.toBeNull();
|
|
299
|
+
expect(createCompilerBlock[0]).not.toContain("devSocket");
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// ---------------------------------------------------------------------------
|
|
304
|
+
// 5. scripts/build.js — compiler.close()
|
|
305
|
+
// ---------------------------------------------------------------------------
|
|
306
|
+
describe("scripts/build.js — wp5 best practices", () => {
|
|
307
|
+
test("calls compiler.close() after compiler.run()", () => {
|
|
308
|
+
expect(buildScript).toContain("compiler.close(");
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// ---------------------------------------------------------------------------
|
|
313
|
+
// 6. config/webpackSchemas.config.js — compiler.close()
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
describe("config/webpackSchemas.config.js — wp5 best practices", () => {
|
|
316
|
+
test("calls compiler.close() after compiler.run()", () => {
|
|
317
|
+
expect(schemasConfig).toContain("compiler.close(");
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// wp4 ignored output.library for commonjs2; wp5 appends it to the prefix, so a name
|
|
321
|
+
// would move the parsed config to module.exports.griddo and break the consumer below.
|
|
322
|
+
test("sets no library name, so the bundle stays module.exports = <exports>", () => {
|
|
323
|
+
expect(schemasConfig).toContain('libraryTarget: "commonjs2"');
|
|
324
|
+
expect(schemasConfig).not.toMatch(/library:\s*"/);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("scripts/griddo-sync-schemas.js reads the bundle default export", () => {
|
|
328
|
+
expect(syncSchemasScript).toContain("_griddoConfig.default");
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// ---------------------------------------------------------------------------
|
|
333
|
+
// 7. package.json — dependencies
|
|
334
|
+
// ---------------------------------------------------------------------------
|
|
335
|
+
describe("package.json — wp5 dependencies", () => {
|
|
336
|
+
const allDeps = {
|
|
337
|
+
...pkgJson.dependencies,
|
|
338
|
+
...pkgJson.devDependencies,
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
test("webpack is ^5.x", () => {
|
|
342
|
+
expect(allDeps.webpack).toMatch(/^\^?5/);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
test("webpack-dev-server is ^4.x", () => {
|
|
346
|
+
expect(allDeps["webpack-dev-server"]).toMatch(/^\^?4/);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
test("html-webpack-plugin is ^5.x", () => {
|
|
350
|
+
expect(allDeps["html-webpack-plugin"]).toMatch(/^\^?5/);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test("mini-css-extract-plugin is ^2.x", () => {
|
|
354
|
+
expect(allDeps["mini-css-extract-plugin"]).toMatch(/^\^?2/);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
test("terser-webpack-plugin is ^5.x", () => {
|
|
358
|
+
expect(allDeps["terser-webpack-plugin"]).toMatch(/^\^?5/);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
test("css-minimizer-webpack-plugin is ^5.x", () => {
|
|
362
|
+
expect(allDeps["css-minimizer-webpack-plugin"]).toMatch(/^\^?5/);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test("webpack-manifest-plugin is ^5.x", () => {
|
|
366
|
+
expect(allDeps["webpack-manifest-plugin"]).toMatch(/^\^?5/);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
test("react-dev-utils is ^12.x", () => {
|
|
370
|
+
expect(allDeps["react-dev-utils"]).toMatch(/^\^?12/);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test("css-loader is ^6.x", () => {
|
|
374
|
+
expect(allDeps["css-loader"]).toMatch(/^\^?6/);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test("babel-loader is ^9.x", () => {
|
|
378
|
+
expect(allDeps["babel-loader"]).toMatch(/^\^?9/);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
test("node-polyfill-webpack-plugin is present (client build polyfills)", () => {
|
|
382
|
+
expect(allDeps).toHaveProperty("node-polyfill-webpack-plugin");
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
test("postcss-loader is ^7.x", () => {
|
|
386
|
+
expect(allDeps["postcss-loader"]).toMatch(/^\^?7/);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
test("keeps postcss-preset-env at 6.x (minimal PostCSS scope)", () => {
|
|
390
|
+
expect(allDeps["postcss-preset-env"]).toMatch(/^\^?6/);
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
test("keeps postcss-normalize (minimal PostCSS scope)", () => {
|
|
394
|
+
expect(allDeps).toHaveProperty("postcss-normalize");
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
test("keeps typescript at 4.9.x (TS bump is out of scope)", () => {
|
|
398
|
+
expect(allDeps.typescript).toMatch(/^\^?4\.9/);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
test("removed wp4-only dependencies are not present", () => {
|
|
402
|
+
const removed = [
|
|
403
|
+
"optimize-css-assets-webpack-plugin",
|
|
404
|
+
"pnp-webpack-plugin",
|
|
405
|
+
"ts-pnp",
|
|
406
|
+
"url-loader",
|
|
407
|
+
"file-loader",
|
|
408
|
+
"postcss-safe-parser",
|
|
409
|
+
"workbox-webpack-plugin",
|
|
410
|
+
];
|
|
411
|
+
for (const dep of removed) {
|
|
412
|
+
expect(allDeps).not.toHaveProperty(dep);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// ---------------------------------------------------------------------------
|
|
418
|
+
// 8. package.json — no --openssl-legacy-provider in scripts
|
|
419
|
+
// ---------------------------------------------------------------------------
|
|
420
|
+
describe("package.json — no openssl legacy provider", () => {
|
|
421
|
+
test("no script uses --openssl-legacy-provider", () => {
|
|
422
|
+
const scripts = Object.values(pkgJson.scripts || {});
|
|
423
|
+
for (const script of scripts) {
|
|
424
|
+
expect(script).not.toContain("--openssl-legacy-provider");
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// ---------------------------------------------------------------------------
|
|
430
|
+
// 9. Deleted files must not exist
|
|
431
|
+
// ---------------------------------------------------------------------------
|
|
432
|
+
describe("deleted wp4-only files", () => {
|
|
433
|
+
test("config/pnpTs.js does not exist", () => {
|
|
434
|
+
expect(fs.existsSync(path.join(configDir, "pnpTs.js"))).toBe(false);
|
|
435
|
+
});
|
|
436
|
+
});
|