Skip to content

Commit 1ab21dc

Browse files
authored
[infra] Stabilise tests by removing babel and plugins from vitest (#18341)
Signed-off-by: Jose C Quintas Jr <[email protected]>
1 parent ad06ce7 commit 1ab21dc

File tree

10 files changed

+347
-333
lines changed

10 files changed

+347
-333
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@
113113
"@typescript-eslint/eslint-plugin": "^8.33.1",
114114
"@typescript-eslint/parser": "catalog:",
115115
"@vitejs/plugin-react": "catalog:",
116-
"@vitest/browser": "^3.2.2",
117-
"@vitest/coverage-v8": "^3.2.2",
116+
"@vitest/browser": "catalog:",
117+
"@vitest/coverage-v8": "catalog:",
118118
"@vvago/vale": "^3.11.2",
119119
"autoprefixer": "catalog:",
120120
"axe-core": "4.10.3",

packages/x-data-grid/src/tests/layout.DataGrid.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ describe('<DataGrid /> - Layout & warnings', () => {
953953
'The Data Grid component requires all rows to have a unique `id` property',
954954
reactMajor < 19 &&
955955
'The Data Grid component requires all rows to have a unique `id` property',
956-
reactMajor < 19 && 'The above error occurred in the <DataGrid> component',
956+
reactMajor < 19 && 'The above error occurred in the <ForwardRef(DataGrid2)> component',
957957
]);
958958
expect((errorRef.current as any).errors).to.have.length(1);
959959
expect((errorRef.current as any).errors[0].toString()).to.include(

packages/x-data-grid/src/tests/slots.DataGrid.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ describe('<DataGrid /> - Slots', () => {
167167
'MUI X: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.',
168168
reactMajor < 19 &&
169169
'MUI X: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.',
170-
reactMajor < 19 && 'The above error occurred in the <GridOverlay> component',
170+
reactMajor < 19 && 'The above error occurred in the <ForwardRef(GridOverlay2)> component',
171171
]);
172172
});
173173

packages/x-tree-view/src/internals/plugins/useTreeViewItems/useTreeViewItems.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ describeTreeView<
2828
'Encountered two children with the same key, `1`',
2929
'MUI X: The Tree View component requires all items to have a unique `id` property.',
3030
'Alternatively, you can use the `getItemId` prop to specify a custom id for each item',
31-
reactMajor < 19 && `The above error occurred in the <TreeItem> component`,
32-
reactMajor < 19 && `The above error occurred in the <TreeItem> component`,
31+
reactMajor < 19 && `The above error occurred in the <ForwardRef(TreeItem2)> component`,
32+
reactMajor < 19 && `The above error occurred in the <ForwardRef(TreeItem2)> component`,
3333
]);
3434
} else {
3535
expect(() =>
@@ -38,7 +38,8 @@ describeTreeView<
3838
'MUI X: The Tree View component requires all items to have a unique `id` property.',
3939
reactMajor < 19 &&
4040
'MUI X: The Tree View component requires all items to have a unique `id` property.',
41-
reactMajor < 19 && `The above error occurred in the <${treeViewComponentName}> component`,
41+
reactMajor < 19 &&
42+
`The above error occurred in the <ForwardRef(${treeViewComponentName}2)> component`,
4243
]);
4344
}
4445
});

pnpm-lock.yaml

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

pnpm-workspace.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ catalog:
4949
'@types/semver': ^7.7.0
5050
'@types/use-sync-external-store': ^1.5.0
5151
'@typescript-eslint/parser': ^8.33.1
52-
'@vitejs/plugin-react': ^4.5.1
5352
autoprefixer: ^10.4.21
5453
babel-plugin-module-resolver: ^5.0.2
5554
babel-plugin-optimize-clsx: ^2.6.2
@@ -83,6 +82,11 @@ catalog:
8382
stylis: ^4.3.6
8483
tsx: ^4.19.4
8584
use-sync-external-store: ^1.5.0
86-
vitest: 3.2.2
85+
vitest: 3.2.3
86+
'@vitejs/plugin-react': ^4.5.2
87+
'@vitejs/plugin-react-swc': ^3.10.2
88+
'@vitest/coverage-v8': ^3.2.2
89+
'@vitest/browser': ^3.2.2
90+
'@vitest/ui': ^3.2.2
8791
webpack-bundle-analyzer: ^4.10.2
8892
yargs: ^18.0.0

test/e2e/vite.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
3-
import { alias } from '../../vitest.shared.mjs';
3+
import { alias } from '../../vitest.shared.mts';
44

55
export default defineConfig({
66
build: {

test/performance-charts/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"@testing-library/react": "^16.3.0",
1717
"@testing-library/user-event": "^14.6.1",
1818
"@vitejs/plugin-react": "catalog:",
19-
"@vitejs/plugin-react-swc": "^3.10.1",
20-
"@vitest/browser": "3.2.2",
21-
"@vitest/ui": "3.2.2",
19+
"@vitejs/plugin-react-swc": "catalog:",
20+
"@vitest/browser": "catalog:",
21+
"@vitest/ui": "catalog:",
2222
"jsdom": "^26.1.0",
2323
"react": "catalog:",
2424
"react-dom": "catalog:",

test/regressions/vite.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'path';
22
import { defineConfig, transformWithEsbuild } from 'vite';
33
import react from '@vitejs/plugin-react';
4-
import { alias } from '../../vitest.shared.mjs';
4+
import { alias } from '../../vitest.shared.mts';
55

66
export default defineConfig({
77
build: {

vitest.shared.mts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,9 @@ export const alias = [
3636
];
3737

3838
export default defineConfig({
39-
plugins: [
40-
react({
41-
babel: {
42-
plugins: [
43-
[
44-
'@mui/internal-babel-plugin-display-name',
45-
{
46-
allowedCallees: {
47-
'@mui/x-internals/forwardRef': ['forwardRef'],
48-
},
49-
},
50-
],
51-
],
52-
babelrc: false,
53-
configFile: false,
54-
},
55-
}),
56-
],
39+
// If enabling babel plugins, ensure the tests in CI are stable
40+
// https://github.com/mui/mui-x/pull/18341
41+
plugins: [react()],
5742
// We seem to need both this and the `env` property below to make it work.
5843
define: {
5944
'process.env.NODE_ENV': '"test"',

0 commit comments

Comments
 (0)