Skip to content

Commit 490db12

Browse files
chore(module-federation): nx 21.5.3 migrate + jest configs (cjs) + jest v30
- run nx migrate, install, run migrations - convert jest configs to .cjs to avoid esm conflicts - strip comments from .swcrc before json.parse - restore and run jest v30 matcher migration
1 parent bb91983 commit 490db12

File tree

41 files changed

+3765
-2557
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3765
-2557
lines changed

package.json

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,29 @@
106106
"@commitlint/cz-commitlint": "19.5.0",
107107
"@fontsource/roboto": "5.1.0",
108108
"@fontsource/roboto-mono": "5.1.0",
109-
"@nx/cypress": "21.2.3",
110-
"@nx/devkit": "21.2.3",
111-
"@nx/esbuild": "21.2.3",
112-
"@nx/eslint": "21.2.3",
113-
"@nx/eslint-plugin": "21.2.3",
114-
"@nx/express": "21.2.3",
115-
"@nx/jest": "21.2.3",
116-
"@nx/js": "21.2.3",
117-
"@nx/module-federation": "21.2.3",
118-
"@nx/node": "21.2.3",
119-
"@nx/react": "21.2.3",
120-
"@nx/rollup": "21.2.3",
121-
"@nx/rspack": "21.2.3",
122-
"@nx/storybook": "21.2.3",
123-
"@nx/vite": "21.2.3",
124-
"@nx/web": "21.2.3",
125-
"@nx/webpack": "21.2.3",
109+
"@nx/cypress": "21.5.3",
110+
"@nx/devkit": "21.5.3",
111+
"@nx/esbuild": "21.5.3",
112+
"@nx/eslint": "21.5.3",
113+
"@nx/eslint-plugin": "21.5.3",
114+
"@nx/express": "21.5.3",
115+
"@nx/jest": "21.5.3",
116+
"@nx/js": "21.5.3",
117+
"@nx/module-federation": "21.5.3",
118+
"@nx/node": "21.5.3",
119+
"@nx/react": "21.5.3",
120+
"@nx/rollup": "21.5.3",
121+
"@nx/rspack": "21.5.3",
122+
"@nx/storybook": "21.5.3",
123+
"@nx/vite": "21.5.3",
124+
"@nx/web": "21.5.3",
125+
"@nx/webpack": "21.5.3",
126126
"@pmmmwh/react-refresh-webpack-plugin": "0.5.15",
127127
"@rollup/plugin-alias": "5.1.1",
128128
"@rollup/plugin-replace": "6.0.1",
129129
"@rslib/core": "^0.10.4",
130-
"@rspack/core": "1.3.9",
131-
"@rspack/dev-server": "1.1.1",
130+
"@rspack/core": "1.5.7",
131+
"@rspack/dev-server": "1.1.4",
132132
"@semantic-release/changelog": "^6.0.3",
133133
"@semantic-release/exec": "^6.0.3",
134134
"@semantic-release/git": "^10.0.1",
@@ -141,7 +141,7 @@
141141
"@swc/cli": "0.6.0",
142142
"@swc/core": "1.7.26",
143143
"@swc/helpers": "0.5.13",
144-
"@swc/jest": "0.2.36",
144+
"@swc/jest": "0.2.39",
145145
"@tailwindcss/forms": "0.5.9",
146146
"@testing-library/react": "16.1.0",
147147
"@types/adm-zip": "0.5.5",
@@ -150,7 +150,7 @@
150150
"@types/eslint": "~8.37.0",
151151
"@types/express": "4.17.21",
152152
"@types/fs-extra": "9.0.13",
153-
"@types/jest": "29.5.13",
153+
"@types/jest": "30.0.0",
154154
"@types/lodash.clonedeepwith": "^4.5.9",
155155
"@types/lodash.get": "4.4.9",
156156
"@types/node": "18.16.9",
@@ -163,7 +163,7 @@
163163
"@vitest/coverage-v8": "1.6.0",
164164
"@vitest/ui": "1.6.0",
165165
"autoprefixer": "10.4.20",
166-
"babel-jest": "29.7.0",
166+
"babel-jest": "30.0.5",
167167
"babel-loader": "9.2.1",
168168
"classnames": "2.5.1",
169169
"commitizen": "^4.3.0",
@@ -187,17 +187,17 @@
187187
"highlight.js": "11.10.0",
188188
"html-webpack-plugin": "5.6.2",
189189
"husky": "8.0.3",
190-
"jest": "29.7.0",
190+
"jest": "30.0.5",
191191
"jest-cli": "29.7.0",
192-
"jest-environment-jsdom": "29.7.0",
192+
"jest-environment-jsdom": "30.0.5",
193193
"jest-environment-node": "29.7.0",
194194
"jiti": "2.4.2",
195195
"js-yaml": "4.1.0",
196196
"kill-port": "^2.0.1",
197197
"mime-types": "2.1.35",
198198
"msw": "^1.2.1",
199199
"node-fetch": "~3.3.2",
200-
"nx": "21.2.3",
200+
"nx": "21.5.3",
201201
"open": "^10.1.0",
202202
"postcss-calc": "9.0.1",
203203
"postcss-custom-properties": "13.3.12",
@@ -214,24 +214,25 @@
214214
"swc-loader": "0.2.6",
215215
"tailwindcss": "3.4.13",
216216
"terser-webpack-plugin": "^5.3.10",
217-
"ts-jest": "29.1.5",
217+
"ts-jest": "29.4.4",
218218
"ts-node": "10.9.1",
219219
"tslib": "2.8.1",
220220
"tsup": "7.3.0",
221-
"typescript": "5.8.3",
221+
"typescript": "5.9.2",
222222
"url-loader": "4.1.1",
223223
"verdaccio": "6.1.2",
224-
"vite": "6.3.5",
224+
"vite": "7.1.7",
225225
"vite-tsconfig-paths": "4.2.3",
226226
"vitest": "1.6.0",
227227
"vitest-fetch-mock": "^0.2.2",
228228
"vue-tsc": "^2.2.10",
229229
"wait-on": "^7.2.0",
230-
"webpack": "5.98.0",
230+
"webpack": "5.101.3",
231231
"webpack-cli": "^5.1.4",
232232
"webpack-virtual-modules": "0.6.2",
233233
"whatwg-fetch": "^3.6.20",
234-
"yargs": "^17.7.2"
234+
"yargs": "^17.7.2",
235+
"jest-util": "30.0.5"
235236
},
236237
"config": {
237238
"commitizen": {

packages/bridge/bridge-react/jest.config.ts renamed to packages/bridge/bridge-react/jest.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default {
1+
module.exports = {
22
displayName: 'bridge-react',
33
preset: '../../../jest.preset.js',
44
transform: {

packages/bridge/bridge-react/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"executor": "@nx/jest:jest",
1616
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
1717
"options": {
18-
"jestConfig": "packages/bridge/bridge-react/jest.config.ts",
18+
"jestConfig": "packages/bridge/bridge-react/jest.config.cjs",
1919
"passWithNoTests": true
2020
}
2121
}

packages/cli/project.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
"assets": [],
1515
"project": "packages/cli/package.json",
1616
"rollupConfig": "packages/cli/rollup.config.js",
17-
"compiler": "swc",
17+
"compiler": "tsc",
1818
"format": ["cjs"],
1919
"generatePackageJson": false,
20-
"useLegacyTypescriptPlugin": false
20+
"useLegacyTypescriptPlugin": false,
21+
"sourceMap": true
2122
}
2223
},
2324
"lint": {

packages/core/jest.config.ts renamed to packages/core/jest.config.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable */
2-
export default {
2+
module.exports = {
33
displayName: 'core',
44
preset: '../../jest.preset.js',
55
globals: {},

packages/core/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"executor": "@nx/jest:jest",
2727
"outputs": ["{workspaceRoot}/coverage/packages/core"],
2828
"options": {
29-
"jestConfig": "packages/core/jest.config.ts",
29+
"jestConfig": "packages/core/jest.config.cjs",
3030
"passWithNoTests": true
3131
}
3232
},

packages/core/src/utils/common.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ describe('Common utils', () => {
1212
extractUrlAndGlobal('test');
1313
};
1414

15-
expect(extract).toThrowError('Invalid request "test"');
15+
expect(extract).toThrow('Invalid request "test"');
1616
});
1717
});

packages/data-prefetch/project.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
"assets": [],
1616
"project": "packages/data-prefetch/package.json",
1717
"rollupConfig": "packages/data-prefetch/rollup.config.cjs",
18-
"compiler": "swc",
18+
"compiler": "tsc",
1919
"format": ["cjs", "esm"],
2020
"generatePackageJson": false,
21-
"useLegacyTypescriptPlugin": false
21+
"useLegacyTypescriptPlugin": false,
22+
"sourceMap": true
2223
}
2324
},
2425
"test": {

packages/enhanced/jest.config.ts renamed to packages/enhanced/jest.config.cjs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
/* eslint-disable */
2-
import { readFileSync, rmdirSync, existsSync } from 'fs';
3-
import path from 'path';
4-
import os from 'os';
5-
const rimraf = require('rimraf');
2+
const { readFileSync, rmSync } = require('fs');
3+
const path = require('path');
4+
const os = require('os');
65

76
// Reading the SWC compilation config and remove the "exclude"
87
// for the test files to be compiled by SWC
9-
const { exclude: _, ...swcJestConfig } = JSON.parse(
10-
readFileSync(`${__dirname}/.swcrc`, 'utf-8'),
11-
);
8+
const swcrcRaw = readFileSync(path.join(__dirname, '.swcrc'), 'utf-8');
9+
const swcrcJson = swcrcRaw.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
10+
const { exclude: _, ...swcJestConfig } = JSON.parse(swcrcJson);
1211

13-
rimraf.sync(__dirname + '/test/js');
12+
rmSync(path.join(__dirname, 'test/js'), { recursive: true, force: true });
1413

1514
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
1615
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
1716
if (swcJestConfig.swcrc === undefined) {
1817
swcJestConfig.swcrc = false;
1918
}
2019

21-
// Uncomment if using global setup/teardown files being transformed via swc
22-
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
23-
// jest needs EsModule Interop to find the default exported setup/teardown functions
24-
// swcJestConfig.module.noInterop = false;
25-
26-
export default {
20+
module.exports = {
2721
displayName: 'enhanced',
2822
preset: '../../jest.preset.js',
2923
cacheDirectory: path.join(os.tmpdir(), 'enhanced'),

0 commit comments

Comments
 (0)