diff --git a/.eslintrc.js b/.eslintrc.js index da6bb3d96712b..6847274cb78b2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -116,6 +116,10 @@ const buildPackageRestrictedImports = (packageName, root, allowRootImports = tru ]), ]; +const mochaPluginOverride = baseline.overrides.find((override) => + override.extends?.includes('plugin:mocha/recommended'), +); + module.exports = { ...baseline, plugins: [ @@ -187,7 +191,19 @@ module.exports = { 'react/no-unstable-nested-components': ['error', { allowAsProps: true }], }, overrides: [ - ...baseline.overrides, + ...baseline.overrides.filter( + (override) => !override.extends?.includes('plugin:mocha/recommended'), + ), + { + ...mochaPluginOverride, + extends: [], + rules: Object.entries(mochaPluginOverride.rules).reduce((acc, [key, value]) => { + if (!key.includes('mocha')) { + acc[key] = value; + } + return acc; + }, {}), + }, { files: [ // matching the pattern of the test runner diff --git a/docs/package.json b/docs/package.json index 69c937736e7cb..36ad439d5f4ec 100644 --- a/docs/package.json +++ b/docs/package.json @@ -104,7 +104,6 @@ "@babel/preset-typescript": "catalog:", "@mui/internal-docs-utils": "^2.0.1", "@mui/internal-scripts": "^2.0.9", - "@types/chai": "catalog:", "@types/chance": "catalog:", "@types/d3-scale": "catalog:", "@types/d3-scale-chromatic": "^3.1.0", diff --git a/docs/src/modules/utils/postProcessImport.test.ts b/docs/src/modules/utils/postProcessImport.test.ts index cf0da86f47666..34327e76d3f9b 100644 --- a/docs/src/modules/utils/postProcessImport.test.ts +++ b/docs/src/modules/utils/postProcessImport.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import adapterDependencies from './adapter-dependencies.json'; import { ADAPTER_TO_LIBRARY, postProcessImport } from './postProcessImport'; diff --git a/docs/tsconfig.json b/docs/tsconfig.json index d06306d746583..062deb721cfc1 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -9,8 +9,16 @@ "skipLibCheck": true, "esModuleInterop": true, "incremental": true, - "types": ["@mui/internal-test-utils/initMatchers", "chai-dom", "mocha"] + "types": ["@mui/internal-test-utils/initMatchers", "vitest/globals"] }, - "include": ["next-env.d.ts", "next.config.mjs", "docs-env.d.ts", "src", "pages/**/*.ts*", "data"], + "include": [ + "next-env.d.ts", + "next.config.mjs", + "docs-env.d.ts", + "src", + "pages/**/*.ts*", + "data", + "../test/utils/addChaiAssertions.ts" + ], "exclude": ["docs/.next", "docs/export", "pages/playground"] } diff --git a/package.json b/package.json index 567f22ad92ccb..1bea2d4ba0c8d 100644 --- a/package.json +++ b/package.json @@ -99,11 +99,9 @@ "@playwright/test": "catalog:", "@types/babel__core": "^7.20.5", "@types/babel__traverse": "^7.20.7", - "@types/chai": "catalog:", "@types/chai-dom": "^1.11.3", "@types/fs-extra": "^11.0.4", "@types/lodash": "catalog:", - "@types/mocha": "^10.0.10", "@types/node": "^24.0.1", "@types/react": "catalog:", "@types/react-dom": "catalog:", @@ -126,7 +124,6 @@ "babel-plugin-transform-inline-environment-variables": "^0.4.4", "babel-plugin-transform-react-remove-prop-types": "catalog:", "babel-plugin-transform-replace-expressions": "^0.2.0", - "chai": "catalog:", "chai-dom": "^1.12.1", "compression-webpack-plugin": "^11.1.0", "concurrently": "^9.1.2", @@ -146,7 +143,6 @@ "eslint-plugin-jsdoc": "^50.8.0", "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-material-ui": "workspace:^", - "eslint-plugin-mocha": "^10.5.0", "eslint-plugin-prettier": "^5.4.1", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-compiler": "19.0.0-beta-ebf51a3-20250411", diff --git a/packages/x-charts-premium/tsconfig.json b/packages/x-charts-premium/tsconfig.json index f63ee3ebfc2ad..4882525d96241 100644 --- a/packages/x-charts-premium/tsconfig.json +++ b/packages/x-charts-premium/tsconfig.json @@ -4,8 +4,7 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], "noImplicitAny": false, diff --git a/packages/x-charts-pro/src/BarChartPro/BarChartPro.test.tsx b/packages/x-charts-pro/src/BarChartPro/BarChartPro.test.tsx index 3d061986f8431..da08afa54041c 100644 --- a/packages/x-charts-pro/src/BarChartPro/BarChartPro.test.tsx +++ b/packages/x-charts-pro/src/BarChartPro/BarChartPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { LicenseInfo } from '@mui/x-license'; import { sharedLicenseStatuses } from '@mui/x-license/useLicenseVerifier/useLicenseVerifier'; diff --git a/packages/x-charts-pro/src/BarChartPro/BarChartPro.zoom.test.tsx b/packages/x-charts-pro/src/BarChartPro/BarChartPro.zoom.test.tsx index e8954ee11d4ec..a6f6c662603db 100644 --- a/packages/x-charts-pro/src/BarChartPro/BarChartPro.zoom.test.tsx +++ b/packages/x-charts-pro/src/BarChartPro/BarChartPro.zoom.test.tsx @@ -1,9 +1,8 @@ /* eslint-disable no-promise-executor-return */ /* eslint-disable no-await-in-loop */ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen, fireEvent, act } from '@mui/internal-test-utils'; -import { describeSkipIf, isJSDOM, testSkipIf } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import * as sinon from 'sinon'; import { BarChartPro } from './BarChartPro'; @@ -19,7 +18,7 @@ const getAxisTickValues = (axis: 'x' | 'y'): string[] => { return axisData as string[]; }; -describeSkipIf(isJSDOM)(' - Zoom', () => { +describe.skipIf(isJSDOM)(' - Zoom', () => { const { render } = createRenderer(); const barChartProps = { @@ -157,7 +156,7 @@ describeSkipIf(isJSDOM)(' - Zoom', () => { // Technically it should work, but it's not working in the test environment // https://github.com/pmndrs/use-gesture/discussions/430 - testSkipIf(true)('should zoom on pinch', async () => { + it.skipIf(true)('should zoom on pinch', async () => { const { user } = render(, options); expect(screen.queryByText('A')).not.to.equal(null); diff --git a/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.test.tsx b/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.test.tsx index 81a7d0bfbdf13..ebb97c6b1ec32 100644 --- a/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.test.tsx +++ b/packages/x-charts-pro/src/ChartContainerPro/ChartContainerPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { LicenseInfo } from '@mui/x-license'; import { sharedLicenseStatuses } from '@mui/x-license/useLicenseVerifier/useLicenseVerifier'; diff --git a/packages/x-charts-pro/src/ChartZoomSlider/internals/zoom-utils.test.ts b/packages/x-charts-pro/src/ChartZoomSlider/internals/zoom-utils.test.ts index 9de6400fc7523..6065954aeb644 100644 --- a/packages/x-charts-pro/src/ChartZoomSlider/internals/zoom-utils.test.ts +++ b/packages/x-charts-pro/src/ChartZoomSlider/internals/zoom-utils.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { calculateZoomEnd, calculateZoomStart, calculateZoomFromPointImpl } from './zoom-utils'; import { ZoomData } from '../../models'; diff --git a/packages/x-charts-pro/src/FunnelChart/FunnelChart.test.tsx b/packages/x-charts-pro/src/FunnelChart/FunnelChart.test.tsx index a6171e490b989..11dc6d3f5e838 100644 --- a/packages/x-charts-pro/src/FunnelChart/FunnelChart.test.tsx +++ b/packages/x-charts-pro/src/FunnelChart/FunnelChart.test.tsx @@ -1,8 +1,7 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, describeConformance, screen } from '@mui/internal-test-utils'; import { Unstable_FunnelChart as FunnelChart } from '@mui/x-charts-pro/FunnelChart'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const config = { series: [{ data: [{ value: 200 }, { value: 100 }] }], @@ -44,7 +43,7 @@ describe('FunnelChart', () => { expect(screen.getByText('No data to display')).toBeVisible(); }); - describeSkipIf(isJSDOM)('gap', () => { + describe.skipIf(isJSDOM)('gap', () => { it('should properly distance sections based on gap', async () => { render(); const paths = document.querySelectorAll('path.MuiFunnelSection-root'); diff --git a/packages/x-charts-pro/src/FunnelChart/checkClickEvent.test.tsx b/packages/x-charts-pro/src/FunnelChart/checkClickEvent.test.tsx index 1e125ee6d62f4..de9acb3cd5a06 100644 --- a/packages/x-charts-pro/src/FunnelChart/checkClickEvent.test.tsx +++ b/packages/x-charts-pro/src/FunnelChart/checkClickEvent.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; import { spy } from 'sinon'; import { Unstable_FunnelChart as FunnelChart } from '@mui/x-charts-pro/FunnelChart'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const config = { series: [ @@ -50,7 +49,7 @@ describe('FunnelChart - click event', () => { describe('onAxisClick', () => { // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onAxisClick = spy(); const { user } = render(
{ }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should provide the right context as second argument with layout="horizontal"', async () => { const onAxisClick = spy(); @@ -145,7 +144,7 @@ describe('FunnelChart - click event', () => { ); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should provide the correct axis values when using category axis', async () => { const onAxisClick = spy(); @@ -210,7 +209,7 @@ describe('FunnelChart - click event', () => { }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onItemClick = spy(); const { user } = render(
{ return axisData as string[]; }; -describeSkipIf(isJSDOM)(' - Zoom', () => { +describe.skipIf(isJSDOM)(' - Zoom', () => { const { render } = createRenderer(); const lineChartProps = { diff --git a/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.test.tsx b/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.test.tsx index 11613c25591de..cf8c45bb21e76 100644 --- a/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.test.tsx +++ b/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { LicenseInfo } from '@mui/x-license'; import { sharedLicenseStatuses } from '@mui/x-license/useLicenseVerifier/useLicenseVerifier'; diff --git a/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.zoom.test.tsx b/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.zoom.test.tsx index 9f0fc5ceee13a..692ea5b8390fa 100644 --- a/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.zoom.test.tsx +++ b/packages/x-charts-pro/src/ScatterChartPro/ScatterChartPro.zoom.test.tsx @@ -1,9 +1,8 @@ /* eslint-disable no-promise-executor-return */ /* eslint-disable no-await-in-loop */ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, fireEvent, act } from '@mui/internal-test-utils'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import * as sinon from 'sinon'; import { ScatterChartPro } from './ScatterChartPro'; @@ -19,7 +18,7 @@ const getAxisTickValues = (axis: 'x' | 'y'): string[] => { return axisData as string[]; }; -describeSkipIf(isJSDOM)(' - Zoom', () => { +describe.skipIf(isJSDOM)(' - Zoom', () => { const { render } = createRenderer(); const scatterChartProps = { diff --git a/packages/x-charts-pro/src/hooks/useFunnelSeries.test.tsx b/packages/x-charts-pro/src/hooks/useFunnelSeries.test.tsx index 83c76bded74cb..991af44f1e228 100644 --- a/packages/x-charts-pro/src/hooks/useFunnelSeries.test.tsx +++ b/packages/x-charts-pro/src/hooks/useFunnelSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useFunnelSeries, useFunnelSeriesContext } from './useFunnelSeries'; import { @@ -41,7 +40,6 @@ describe('useFunnelSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('useFunnelSeries', () => { it('should return the specific funnel series when a single seriesId is provided', () => { const { result } = renderHook(() => useFunnelSeries('1'), options); diff --git a/packages/x-charts-pro/src/hooks/useHeatmapSeries.test.tsx b/packages/x-charts-pro/src/hooks/useHeatmapSeries.test.tsx index d82404dda65ac..04023dbbfecd6 100644 --- a/packages/x-charts-pro/src/hooks/useHeatmapSeries.test.tsx +++ b/packages/x-charts-pro/src/hooks/useHeatmapSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useHeatmapSeries, useHeatmapSeriesContext } from './useHeatmapSeries'; import { Heatmap } from '../Heatmap'; @@ -48,7 +47,6 @@ describe('useHeatmapSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('useHeatmapSeries', () => { it('should return the specific heatmap series when a single seriesId is provided', () => { const { result } = renderHook(() => useHeatmapSeries('1'), options); diff --git a/packages/x-charts-pro/src/internals/plugins/useChartProZoom/calculateZoom.test.ts b/packages/x-charts-pro/src/internals/plugins/useChartProZoom/calculateZoom.test.ts index 4e0fc1816c621..da97e4ce5aaa1 100644 --- a/packages/x-charts-pro/src/internals/plugins/useChartProZoom/calculateZoom.test.ts +++ b/packages/x-charts-pro/src/internals/plugins/useChartProZoom/calculateZoom.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { calculateZoom } from './calculateZoom'; describe('calculateZoom', () => { diff --git a/packages/x-charts-pro/src/internals/plugins/useChartProZoom/useChartProZoom.test.ts b/packages/x-charts-pro/src/internals/plugins/useChartProZoom/useChartProZoom.test.ts index 5d0bfb0ee2b97..e68ec924ca232 100644 --- a/packages/x-charts-pro/src/internals/plugins/useChartProZoom/useChartProZoom.test.ts +++ b/packages/x-charts-pro/src/internals/plugins/useChartProZoom/useChartProZoom.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { ZoomData } from '@mui/x-charts/internals'; import { initializeZoomData } from './useChartProZoom'; diff --git a/packages/x-charts-pro/tsconfig.json b/packages/x-charts-pro/tsconfig.json index f63ee3ebfc2ad..4882525d96241 100644 --- a/packages/x-charts-pro/tsconfig.json +++ b/packages/x-charts-pro/tsconfig.json @@ -4,8 +4,7 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], "noImplicitAny": false, diff --git a/packages/x-charts-vendor/src/tests/d3-interpolate.test.ts b/packages/x-charts-vendor/src/tests/d3-interpolate.test.ts index 4c201621f3f66..d30595d65d164 100644 --- a/packages/x-charts-vendor/src/tests/d3-interpolate.test.ts +++ b/packages/x-charts-vendor/src/tests/d3-interpolate.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; /* * This test verifies that these modules and types are exported correctly diff --git a/packages/x-charts-vendor/src/tests/d3-scale.test.ts b/packages/x-charts-vendor/src/tests/d3-scale.test.ts index 2f9419cbb3309..e751237b99977 100644 --- a/packages/x-charts-vendor/src/tests/d3-scale.test.ts +++ b/packages/x-charts-vendor/src/tests/d3-scale.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { scaleLinear, diff --git a/packages/x-charts-vendor/tsconfig.json b/packages/x-charts-vendor/tsconfig.json index 2b84a70b31ca1..bd94436557362 100644 --- a/packages/x-charts-vendor/tsconfig.json +++ b/packages/x-charts-vendor/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["mocha"] + "types": ["vitest/globals"] }, "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"], "exclude": ["es", "lib", "jest.config.ts"] diff --git a/packages/x-charts/src/BarChart/BarChart.test.tsx b/packages/x-charts/src/BarChart/BarChart.test.tsx index 8895788e3a8be..45627c9c46f07 100644 --- a/packages/x-charts/src/BarChart/BarChart.test.tsx +++ b/packages/x-charts/src/BarChart/BarChart.test.tsx @@ -2,9 +2,8 @@ import * as React from 'react'; import { createRenderer } from '@mui/internal-test-utils/createRenderer'; import { describeConformance } from 'test/utils/describeConformance'; import { BarChart, barElementClasses } from '@mui/x-charts/BarChart'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; -import { isJSDOM, testSkipIf } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe('', () => { const { render } = createRenderer(); @@ -49,7 +48,7 @@ describe('', () => { ); // svg.createSVGPoint not supported by JSDom https://github.com/jsdom/jsdom/issues/300 - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should hide tooltip if the item the tooltip was showing is removed', async () => { const { setProps, user } = render( @@ -79,7 +78,7 @@ describe('', () => { ); // svg.createSVGPoint not supported by JSDom https://github.com/jsdom/jsdom/issues/300 - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should hide tooltip if the series of the item the tooltip was showing is removed', async () => { const { setProps, user } = render( diff --git a/packages/x-charts/src/BarChart/checkClickEvent.test.tsx b/packages/x-charts/src/BarChart/checkClickEvent.test.tsx index 7a310fb5514e8..2d8f046468f53 100644 --- a/packages/x-charts/src/BarChart/checkClickEvent.test.tsx +++ b/packages/x-charts/src/BarChart/checkClickEvent.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; import { spy } from 'sinon'; import { BarChart } from '@mui/x-charts/BarChart'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const config = { dataset: [ @@ -30,7 +29,7 @@ describe('BarChart - click event', () => { describe('onAxisClick', () => { // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onAxisClick = spy(); const { user } = render(
{ }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should provide the right context as second argument with layout="horizontal"', async () => { const onAxisClick = spy(); @@ -159,7 +158,7 @@ describe('BarChart - click event', () => { }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onItemClick = spy(); const { user } = render(
{ diff --git a/packages/x-charts/src/ChartsLabel/ChartsLabelGradient.test.tsx b/packages/x-charts/src/ChartsLabel/ChartsLabelGradient.test.tsx index 086f7f45c93df..ed7a447fb4b9d 100644 --- a/packages/x-charts/src/ChartsLabel/ChartsLabelGradient.test.tsx +++ b/packages/x-charts/src/ChartsLabel/ChartsLabelGradient.test.tsx @@ -4,8 +4,7 @@ import { describeConformance } from 'test/utils/describeConformance'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import { ChartsLabelGradient } from '@mui/x-charts/ChartsLabel/ChartsLabelGradient'; import { labelGradientClasses } from '@mui/x-charts/ChartsLabel'; -import { expect } from 'chai'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import RtlProvider from '@mui/system/RtlProvider'; describe('', () => { @@ -33,7 +32,7 @@ describe('', () => { })); // JSDOM does not support SVGMatrix - describeSkipIf(isJSDOM)('rotation', () => { + describe.skipIf(isJSDOM)('rotation', () => { const matrixToRotation = (element: SVGSVGElement | null) => { if (!element) { throw new Error('Svg element not found'); diff --git a/packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.test.tsx b/packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.test.tsx index c5c42c95df03a..3bb6dfaf6cbc0 100644 --- a/packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.test.tsx +++ b/packages/x-charts/src/ChartsLocalizationProvider/ChartsLocalizationProvider.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { createRenderer } from '@mui/internal-test-utils'; import { createTheme, ThemeProvider } from '@mui/material/styles'; diff --git a/packages/x-charts/src/ChartsSurface/ChartsSurface.test.tsx b/packages/x-charts/src/ChartsSurface/ChartsSurface.test.tsx index 66367f763fc6a..fe7ee7c76a187 100644 --- a/packages/x-charts/src/ChartsSurface/ChartsSurface.test.tsx +++ b/packages/x-charts/src/ChartsSurface/ChartsSurface.test.tsx @@ -1,12 +1,11 @@ import * as React from 'react'; import { createRenderer } from '@mui/internal-test-utils'; import { ChartsSurface } from '@mui/x-charts/ChartsSurface'; -import { expect } from 'chai'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { ChartProvider } from '../context/ChartProvider'; // JSDOM doesn't implement SVGElement -describeSkipIf(isJSDOM)('', () => { +describe.skipIf(isJSDOM)('', () => { const { render } = createRenderer(); it('should pass ref when it is added directly to component', () => { diff --git a/packages/x-charts/src/ChartsTooltip/contentDisplayed.test.tsx b/packages/x-charts/src/ChartsTooltip/contentDisplayed.test.tsx index c608827891393..badb20212dd86 100644 --- a/packages/x-charts/src/ChartsTooltip/contentDisplayed.test.tsx +++ b/packages/x-charts/src/ChartsTooltip/contentDisplayed.test.tsx @@ -1,8 +1,7 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, waitFor } from '@mui/internal-test-utils'; import { BarChart, BarChartProps } from '@mui/x-charts/BarChart'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { useItemTooltip } from './useItemTooltip'; import { useBarSeries } from '../hooks'; import { ChartsTooltipContainer } from './ChartsTooltipContainer'; @@ -39,7 +38,7 @@ const cellSelector = '.MuiChartsTooltip-root td, .MuiChartsTooltip-root th, .MuiChartsTooltip-root caption'; // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 -describeSkipIf(isJSDOM)('ChartsTooltip', () => { +describe.skipIf(isJSDOM)('ChartsTooltip', () => { const { render } = createRenderer(); const wrapper = ({ children }: { children?: React.ReactNode }) => (
{children}
diff --git a/packages/x-charts/src/LineChart/LineChart.test.tsx b/packages/x-charts/src/LineChart/LineChart.test.tsx index 8cf1e45c8684d..ce6c561ac006a 100644 --- a/packages/x-charts/src/LineChart/LineChart.test.tsx +++ b/packages/x-charts/src/LineChart/LineChart.test.tsx @@ -2,7 +2,6 @@ import * as React from 'react'; import { createRenderer } from '@mui/internal-test-utils/createRenderer'; import { describeConformance } from 'test/utils/describeConformance'; import { LineChart } from '@mui/x-charts/LineChart'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; describe('', () => { diff --git a/packages/x-charts/src/LineChart/checkClickEvent.test.tsx b/packages/x-charts/src/LineChart/checkClickEvent.test.tsx index 39be012d16f6b..b68b588d7cee8 100644 --- a/packages/x-charts/src/LineChart/checkClickEvent.test.tsx +++ b/packages/x-charts/src/LineChart/checkClickEvent.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; import { spy } from 'sinon'; import { LineChart } from '@mui/x-charts/LineChart'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const config = { dataset: [ @@ -24,7 +23,7 @@ describe('LineChart - click event', () => { describe('onAxisClick', () => { // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onAxisClick = spy(); const { user } = render(
{ }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onMarkClick = spy(); const { user } = render(
{ }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onAreaClick = spy(); const { user } = render(
{ }); // can't do Pointer event with JSDom https://github.com/jsdom/jsdom/issues/2527 - testSkipIf(isJSDOM)('should provide the right context as second argument', async () => { + it.skipIf(isJSDOM)('should provide the right context as second argument', async () => { const onLineClick = spy(); const { user } = render(
', () => { const { render } = createRenderer(); diff --git a/packages/x-charts/src/PieChart/checkClickEvent.test.tsx b/packages/x-charts/src/PieChart/checkClickEvent.test.tsx index a9c9ac28d544f..8894b38fdf9b2 100644 --- a/packages/x-charts/src/PieChart/checkClickEvent.test.tsx +++ b/packages/x-charts/src/PieChart/checkClickEvent.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; import { spy } from 'sinon'; import { PieChart } from '@mui/x-charts/PieChart'; diff --git a/packages/x-charts/src/RadarChart/RadarChart.test.tsx b/packages/x-charts/src/RadarChart/RadarChart.test.tsx index d6b3d37597b76..519ac86a7e84a 100644 --- a/packages/x-charts/src/RadarChart/RadarChart.test.tsx +++ b/packages/x-charts/src/RadarChart/RadarChart.test.tsx @@ -2,9 +2,8 @@ import * as React from 'react'; import { createRenderer, screen } from '@mui/internal-test-utils/createRenderer'; import { describeConformance } from 'test/utils/describeConformance'; import { Unstable_RadarChart as RadarChart, RadarChartProps } from '@mui/x-charts/RadarChart'; -import { expect } from 'chai'; import { spy } from 'sinon'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const radarConfig: RadarChartProps = { height: 100, @@ -44,7 +43,7 @@ describe('', () => { }); // svg.createSVGPoint not supported by JSDom https://github.com/jsdom/jsdom/issues/300 - testSkipIf(isJSDOM)('should call onHighlightChange', async () => { + it.skipIf(isJSDOM)('should call onHighlightChange', async () => { const onHighlightChange = spy(); const { user } = render(); @@ -54,7 +53,7 @@ describe('', () => { expect(onHighlightChange.callCount).to.equal(1); }); - testSkipIf(isJSDOM)('should highlight axis on hover', async () => { + it.skipIf(isJSDOM)('should highlight axis on hover', async () => { const { user } = render(
', () => { } as const; // svg.createSVGPoint not supported by JSDom https://github.com/jsdom/jsdom/issues/300 - testSkipIf(isJSDOM)('should show the tooltip without errors in default config', async () => { + it.skipIf(isJSDOM)('should show the tooltip without errors in default config', async () => { const { user } = render(
', () => { expect([...cells].map((cell) => cell.textContent)).to.deep.equal(['series', '(5, 5)']); }); - testSkipIf(isJSDOM)('should show the tooltip without errors with voronoi disabled', async () => { + it.skipIf(isJSDOM)('should show the tooltip without errors with voronoi disabled', async () => { const { user } = render(
', () => { expect([...cells].map((cell) => cell.textContent)).to.deep.equal(['', '(5, 5)']); }); - testSkipIf(isJSDOM)('should support dataset with missing values', async () => { + it.skipIf(isJSDOM)('should support dataset with missing values', async () => { // x from 500 to 600 // y from 100 to 200 const dataset = [ diff --git a/packages/x-charts/src/ScatterChart/checkClickEvent.test.tsx b/packages/x-charts/src/ScatterChart/checkClickEvent.test.tsx index 1d861c3fa99b2..640d82867486e 100644 --- a/packages/x-charts/src/ScatterChart/checkClickEvent.test.tsx +++ b/packages/x-charts/src/ScatterChart/checkClickEvent.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; import { spy } from 'sinon'; import { ScatterChart } from '@mui/x-charts/ScatterChart'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const config = { dataset: [ @@ -32,7 +31,7 @@ describe('ScatterChart - click event', () => { const { render } = createRenderer(); // svg.createSVGPoint not supported by JSDom https://github.com/jsdom/jsdom/issues/300 - describeSkipIf(isJSDOM)('onItemClick - using voronoi', () => { + describe.skipIf(isJSDOM)('onItemClick - using voronoi', () => { it('should provide the right context as second argument when clicking svg', async () => { const onItemClick = spy(); const { user } = render( diff --git a/packages/x-charts/src/Toolbar/Toolbar.test.tsx b/packages/x-charts/src/Toolbar/Toolbar.test.tsx index 8c5240da7e354..4a1ecec1b1e61 100644 --- a/packages/x-charts/src/Toolbar/Toolbar.test.tsx +++ b/packages/x-charts/src/Toolbar/Toolbar.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { createRenderer, screen, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { LineChart } from '@mui/x-charts/LineChart'; import { Toolbar, ToolbarButton } from '@mui/x-charts/Toolbar'; diff --git a/packages/x-charts/src/hooks/useBarSeries.test.tsx b/packages/x-charts/src/hooks/useBarSeries.test.tsx index 377783c101921..ff69a8e574548 100644 --- a/packages/x-charts/src/hooks/useBarSeries.test.tsx +++ b/packages/x-charts/src/hooks/useBarSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useBarSeries, useBarSeriesContext } from './useBarSeries'; import { BarSeriesType, DefaultizedBarSeriesType } from '../models'; @@ -38,7 +37,6 @@ describe('useBarSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('useBarSeries', () => { it('should return the specific bar series when a single seriesId is provided', () => { const { result } = renderHook(() => useBarSeries('1'), options); diff --git a/packages/x-charts/src/hooks/useChartGradientId.test.tsx b/packages/x-charts/src/hooks/useChartGradientId.test.tsx index 8808059c98b29..7a7a865ab55e9 100644 --- a/packages/x-charts/src/hooks/useChartGradientId.test.tsx +++ b/packages/x-charts/src/hooks/useChartGradientId.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { useChartGradientId, useChartGradientIdObjectBound } from './useChartGradientId'; import { ChartDataProvider } from '../ChartDataProvider'; diff --git a/packages/x-charts/src/hooks/useLineSeries.test.tsx b/packages/x-charts/src/hooks/useLineSeries.test.tsx index baaa9cda91344..1427f25e0ad3e 100644 --- a/packages/x-charts/src/hooks/useLineSeries.test.tsx +++ b/packages/x-charts/src/hooks/useLineSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useLineSeries, useLineSeriesContext } from './useLineSeries'; import { DefaultizedLineSeriesType, LineSeriesType } from '../models'; @@ -38,7 +37,6 @@ describe('useLineSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('useLineSeries', () => { it('should return the specific line series when a single seriesId is provided', () => { const { result } = renderHook(() => useLineSeries('1'), options); diff --git a/packages/x-charts/src/hooks/usePieSeries.test.tsx b/packages/x-charts/src/hooks/usePieSeries.test.tsx index 927c15a24d8cd..15978285e5a9a 100644 --- a/packages/x-charts/src/hooks/usePieSeries.test.tsx +++ b/packages/x-charts/src/hooks/usePieSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { usePieSeries, usePieSeriesContext } from './usePieSeries'; import { DefaultizedPieSeriesType, PieSeriesType } from '../models'; @@ -38,7 +37,6 @@ describe('usePieSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('usePieSeries', () => { it('should return the specific pie series when a single seriesId is provided', () => { const { result } = renderHook(() => usePieSeries('1'), options); diff --git a/packages/x-charts/src/hooks/useRadarSeries.test.tsx b/packages/x-charts/src/hooks/useRadarSeries.test.tsx index d320e2cc60471..d961b6e7fb640 100644 --- a/packages/x-charts/src/hooks/useRadarSeries.test.tsx +++ b/packages/x-charts/src/hooks/useRadarSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useRadarSeries, useRadarSeriesContext } from './useRadarSeries'; import { DefaultizedRadarSeriesType, RadarSeriesType } from '../models'; @@ -39,7 +38,6 @@ describe('useRadarSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('useRadarSeries', () => { it('should return the specific radar series when a single seriesId is provided', () => { const { result } = renderHook(() => useRadarSeries('1'), options); diff --git a/packages/x-charts/src/hooks/useScatterSeries.test.tsx b/packages/x-charts/src/hooks/useScatterSeries.test.tsx index 733ee6b2f1f16..72d2bf819c1a7 100644 --- a/packages/x-charts/src/hooks/useScatterSeries.test.tsx +++ b/packages/x-charts/src/hooks/useScatterSeries.test.tsx @@ -1,5 +1,4 @@ import { renderHook, RenderHookResult } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useScatterSeries, useScatterSeriesContext } from './useScatterSeries'; import { DefaultizedScatterSeriesType, ScatterSeriesType } from '../models'; @@ -44,7 +43,6 @@ describe('useScatterSeriesContext', () => { }); }); -// eslint-disable-next-line mocha/max-top-level-suites describe('useScatterSeries', () => { it('should return the specific scatter series when a single seriesId is provided', () => { const { result } = renderHook(() => useScatterSeries('1'), options); diff --git a/packages/x-charts/src/hooks/useSeries.test.tsx b/packages/x-charts/src/hooks/useSeries.test.tsx index 88ed862b2b5fa..799e9053c3826 100644 --- a/packages/x-charts/src/hooks/useSeries.test.tsx +++ b/packages/x-charts/src/hooks/useSeries.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { ErrorBoundary, createRenderer, reactMajor, screen } from '@mui/internal-test-utils'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { useSeries } from './useSeries'; import { ChartProvider } from '../context/ChartProvider'; @@ -15,7 +14,7 @@ describe('useSeries', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw an error when parent context not present', () => { + it.skipIf(!isJSDOM)('should throw an error when parent context not present', () => { const errorRef = React.createRef(); const errorMessage1 = 'MUI X Charts: Could not find the Chart context.'; diff --git a/packages/x-charts/src/hooks/useSkipAnimation.test.tsx b/packages/x-charts/src/hooks/useSkipAnimation.test.tsx index 9259afa47e30b..d158964320af5 100644 --- a/packages/x-charts/src/hooks/useSkipAnimation.test.tsx +++ b/packages/x-charts/src/hooks/useSkipAnimation.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { ChartProvider } from '../context/ChartProvider'; import { useSkipAnimation } from './useSkipAnimation'; diff --git a/packages/x-charts/src/hooks/useSvgRef.test.tsx b/packages/x-charts/src/hooks/useSvgRef.test.tsx index b9077c93036bf..4d8af4723bd2b 100644 --- a/packages/x-charts/src/hooks/useSvgRef.test.tsx +++ b/packages/x-charts/src/hooks/useSvgRef.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { ErrorBoundary, createRenderer, reactMajor, screen } from '@mui/internal-test-utils'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { useSvgRef } from './useSvgRef'; import { ChartProvider } from '../context/ChartProvider'; @@ -19,7 +18,7 @@ describe('useSvgRef', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw an error when parent context not present', () => { + it.skipIf(!isJSDOM)('should throw an error when parent context not present', () => { const errorRef = React.createRef(); const errorMessages = [ diff --git a/packages/x-charts/src/internals/animation/useAnimate.test.tsx b/packages/x-charts/src/internals/animation/useAnimate.test.tsx index 945ff52ff6f1d..7c2a48d897c75 100644 --- a/packages/x-charts/src/internals/animation/useAnimate.test.tsx +++ b/packages/x-charts/src/internals/animation/useAnimate.test.tsx @@ -1,5 +1,4 @@ import { createRenderer, reactMajor, screen, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import * as React from 'react'; import { useAnimateInternal } from '@mui/x-charts/internals/animation/useAnimateInternal'; import { interpolateNumber } from '@mui/x-charts-vendor/d3-interpolate'; diff --git a/packages/x-charts/src/internals/clampAngle.test.ts b/packages/x-charts/src/internals/clampAngle.test.ts index dc40f6facc30a..f94c4049e6b32 100644 --- a/packages/x-charts/src/internals/clampAngle.test.ts +++ b/packages/x-charts/src/internals/clampAngle.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { clampAngle } from './clampAngle'; describe('clampAngle', () => { diff --git a/packages/x-charts/src/internals/ellipsize.test.ts b/packages/x-charts/src/internals/ellipsize.test.ts index bcb9c47105a6a..d415a81592986 100644 --- a/packages/x-charts/src/internals/ellipsize.test.ts +++ b/packages/x-charts/src/internals/ellipsize.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { ellipsize } from './ellipsize'; describe('ellipsizeText', () => { diff --git a/packages/x-charts/src/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.test.tsx b/packages/x-charts/src/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.test.tsx index e7e3a81db07c5..2e244f372990f 100644 --- a/packages/x-charts/src/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.test.tsx +++ b/packages/x-charts/src/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { BarChart } from '@mui/x-charts/BarChart'; describe('useChartCartesianAxis', () => { @@ -9,7 +8,7 @@ describe('useChartCartesianAxis', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw an error when axis have duplicate ids', () => { + it.skipIf(!isJSDOM)('should throw an error when axis have duplicate ids', () => { const expectedError = [ 'MUI X Charts: The following axis ids are duplicated: qwerty.', 'Please make sure that each axis has a unique id.', @@ -32,7 +31,7 @@ describe('useChartCartesianAxis', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)( + it.skipIf(!isJSDOM)( 'should throw an error when axis have duplicate ids across different directions (x,y)', () => { const expectedError = [ diff --git a/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.test.ts b/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.test.ts index d64cc199d8145..7949acf343779 100644 --- a/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.test.ts +++ b/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { createIsFaded } from './createIsFaded'; const seriesId = 'id1'; diff --git a/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.test.ts b/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.test.ts index a8b8bb2da7c49..263d408160264 100644 --- a/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.test.ts +++ b/packages/x-charts/src/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { createIsHighlighted } from './createIsHighlighted'; const seriesId = 'id1'; diff --git a/packages/x-charts/src/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.test.tsx b/packages/x-charts/src/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.test.tsx index 018f0a734fcce..1e033cdeca975 100644 --- a/packages/x-charts/src/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.test.tsx +++ b/packages/x-charts/src/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer } from '@mui/internal-test-utils'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { ChartDataProvider } from '@mui/x-charts/ChartDataProvider'; import { UseChartPolarAxisSignature } from './useChartPolarAxis.types'; import { useChartPolarAxis } from './useChartPolarAxis'; @@ -11,7 +10,7 @@ describe('useChartPolarAxis', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw an error when axis have duplicate ids', () => { + it.skipIf(!isJSDOM)('should throw an error when axis have duplicate ids', () => { const expectedError = [ 'MUI X Charts: The following axis ids are duplicated: qwerty.', 'Please make sure that each axis has a unique id.', @@ -34,7 +33,7 @@ describe('useChartPolarAxis', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)( + it.skipIf(!isJSDOM)( 'should throw an error when axis have duplicate ids across different directions (radius, rotation)', () => { const expectedError = [ diff --git a/packages/x-charts/src/internals/sliceUntil.test.ts b/packages/x-charts/src/internals/sliceUntil.test.ts index 619ef5932352d..6fee0827174b3 100644 --- a/packages/x-charts/src/internals/sliceUntil.test.ts +++ b/packages/x-charts/src/internals/sliceUntil.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { sliceUntil } from './sliceUntil'; describe('sliceUntil', () => { diff --git a/packages/x-charts/src/internals/ticks.test.ts b/packages/x-charts/src/internals/ticks.test.ts index 0d14f65f84d1c..02fbf3525e414 100644 --- a/packages/x-charts/src/internals/ticks.test.ts +++ b/packages/x-charts/src/internals/ticks.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { scaleTickNumberByRange } from './ticks'; describe('scaleTickNumberByRange', () => { diff --git a/packages/x-charts/tsconfig.json b/packages/x-charts/tsconfig.json index a31f6f717c87e..58e8f08517683 100644 --- a/packages/x-charts/tsconfig.json +++ b/packages/x-charts/tsconfig.json @@ -4,8 +4,7 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], "skipLibCheck": true diff --git a/packages/x-codemod/src/v6.0.0/component-rename-prop/component-rename-prop.test.ts b/packages/x-codemod/src/v6.0.0/component-rename-prop/component-rename-prop.test.ts index a799c487944c7..c1acd452ed52f 100644 --- a/packages/x-codemod/src/v6.0.0/component-rename-prop/component-rename-prop.test.ts +++ b/packages/x-codemod/src/v6.0.0/component-rename-prop/component-rename-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/column-menu-components-rename/column-menu-components-rename.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/column-menu-components-rename/column-menu-components-rename.test.ts index 96802e967a532..c52169c956662 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/column-menu-components-rename/column-menu-components-rename.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/column-menu-components-rename/column-menu-components-rename.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/preset-safe/preset-safe.test.ts index d99d096d41122..638cf49f769db 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/remove-disableExtendRowFullWidth-prop/remove-disableExtendRowFulWidth-prop.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/remove-disableExtendRowFullWidth-prop/remove-disableExtendRowFulWidth-prop.test.ts index 78d4d818b69eb..f506384f474a3 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/remove-disableExtendRowFullWidth-prop/remove-disableExtendRowFulWidth-prop.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/remove-disableExtendRowFullWidth-prop/remove-disableExtendRowFulWidth-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts index b3db45a9f7c7f..0b4b7f57c2f7b 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/rename-components-to-slots/rename-components-to-slots.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/rename-components-to-slots/rename-components-to-slots.test.ts index 82be80a525861..9bd25fff7b0fc 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/rename-components-to-slots/rename-components-to-slots.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/rename-components-to-slots/rename-components-to-slots.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/rename-filter-item-props/rename-filter-item-props.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/rename-filter-item-props/rename-filter-item-props.test.ts index f6790c6a79c9f..28c51b0a45098 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/rename-filter-item-props/rename-filter-item-props.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/rename-filter-item-props/rename-filter-item-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/rename-linkOperators-logicOperators/rename-linkOperators-logicOperators.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/rename-linkOperators-logicOperators/rename-linkOperators-logicOperators.test.ts index a52568c21e5a2..4958c222b5e4f 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/rename-linkOperators-logicOperators/rename-linkOperators-logicOperators.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/rename-linkOperators-logicOperators/rename-linkOperators-logicOperators.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/rename-rowsPerPageOptions-prop/rename-rowsPerPageOptions-prop.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/rename-rowsPerPageOptions-prop/rename-rowsPerPageOptions-prop.test.ts index 78d4d818b69eb..f506384f474a3 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/rename-rowsPerPageOptions-prop/rename-rowsPerPageOptions-prop.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/rename-rowsPerPageOptions-prop/rename-rowsPerPageOptions-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/rename-selectors-and-events/rename-selectors-and-events.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/rename-selectors-and-events/rename-selectors-and-events.test.ts index 4bfe3e8f7f93e..70e7edbe19b63 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/rename-selectors-and-events/rename-selectors-and-events.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/rename-selectors-and-events/rename-selectors-and-events.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/replace-onCellFocusOut-prop/replace-onCellFocusOut-prop.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/replace-onCellFocusOut-prop/replace-onCellFocusOut-prop.test.ts index ace5ba86010d3..c0a36a2267dc9 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/replace-onCellFocusOut-prop/replace-onCellFocusOut-prop.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/replace-onCellFocusOut-prop/replace-onCellFocusOut-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/data-grid/row-selection-props-rename/row-selection-props-rename.test.ts b/packages/x-codemod/src/v6.0.0/data-grid/row-selection-props-rename/row-selection-props-rename.test.ts index 9be4d7269f59b..5d90b0ad2f7d5 100644 --- a/packages/x-codemod/src/v6.0.0/data-grid/row-selection-props-rename/row-selection-props-rename.test.ts +++ b/packages/x-codemod/src/v6.0.0/data-grid/row-selection-props-rename/row-selection-props-rename.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/adapter-change-import/adapter-change-import.test.ts b/packages/x-codemod/src/v6.0.0/pickers/adapter-change-import/adapter-change-import.test.ts index 712054c21ddad..d613b65ea0645 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/adapter-change-import/adapter-change-import.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/adapter-change-import/adapter-change-import.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/localization-provider-rename-locale/localization-provider-rename-locale.test.ts b/packages/x-codemod/src/v6.0.0/pickers/localization-provider-rename-locale/localization-provider-rename-locale.test.ts index 582b631c6cd78..b272a5af09eff 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/localization-provider-rename-locale/localization-provider-rename-locale.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/localization-provider-rename-locale/localization-provider-rename-locale.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/migrate-to-components-componentsProps/migrate-to-components-componentsProps.test.ts b/packages/x-codemod/src/v6.0.0/pickers/migrate-to-components-componentsProps/migrate-to-components-componentsProps.test.ts index 9ce9f2c5fa503..a6d8f8ffd3b34 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/migrate-to-components-componentsProps/migrate-to-components-componentsProps.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/migrate-to-components-componentsProps/migrate-to-components-componentsProps.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v6.0.0/pickers/preset-safe/preset-safe.test.ts index 981997c397aeb..f2daa44daadfc 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/rename-components-to-slots/rename-components-to-slots.test.ts b/packages/x-codemod/src/v6.0.0/pickers/rename-components-to-slots/rename-components-to-slots.test.ts index eee074da1235e..2544dac5542e7 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/rename-components-to-slots/rename-components-to-slots.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/rename-components-to-slots/rename-components-to-slots.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/rename-default-toolbar-title-localeText/rename-default-toolbar-title-localeText.test.ts b/packages/x-codemod/src/v6.0.0/pickers/rename-default-toolbar-title-localeText/rename-default-toolbar-title-localeText.test.ts index 6a427caef857c..e45f5fedc0e94 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/rename-default-toolbar-title-localeText/rename-default-toolbar-title-localeText.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/rename-default-toolbar-title-localeText/rename-default-toolbar-title-localeText.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/rename-inputFormat-prop/rename-inputFormat-prop.test.ts b/packages/x-codemod/src/v6.0.0/pickers/rename-inputFormat-prop/rename-inputFormat-prop.test.ts index bfb42b33d2dfd..e787cf07b4760 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/rename-inputFormat-prop/rename-inputFormat-prop.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/rename-inputFormat-prop/rename-inputFormat-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/rename-should-disable-time/rename-should-disable-time.test.ts b/packages/x-codemod/src/v6.0.0/pickers/rename-should-disable-time/rename-should-disable-time.test.ts index 924142da69ea8..f7295506cb70c 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/rename-should-disable-time/rename-should-disable-time.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/rename-should-disable-time/rename-should-disable-time.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/replace-arrows-button-slot/replace-tabs-props.test.ts b/packages/x-codemod/src/v6.0.0/pickers/replace-arrows-button-slot/replace-tabs-props.test.ts index e8c75449c7783..ad674be391c31 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/replace-arrows-button-slot/replace-tabs-props.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/replace-arrows-button-slot/replace-tabs-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/replace-tabs-props/replace-tabs-props.test.ts b/packages/x-codemod/src/v6.0.0/pickers/replace-tabs-props/replace-tabs-props.test.ts index a66075e1ea016..8f2226f74e6bc 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/replace-tabs-props/replace-tabs-props.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/replace-tabs-props/replace-tabs-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/replace-toolbar-props-by-slot/replace-toolbar-props-by-slot.test.ts b/packages/x-codemod/src/v6.0.0/pickers/replace-toolbar-props-by-slot/replace-toolbar-props-by-slot.test.ts index b23da0b7265ef..4f87c1304fcce 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/replace-toolbar-props-by-slot/replace-toolbar-props-by-slot.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/replace-toolbar-props-by-slot/replace-toolbar-props-by-slot.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/text-props-to-localeText/text-props-to-localeText.test.js b/packages/x-codemod/src/v6.0.0/pickers/text-props-to-localeText/text-props-to-localeText.test.ts similarity index 98% rename from packages/x-codemod/src/v6.0.0/pickers/text-props-to-localeText/text-props-to-localeText.test.js rename to packages/x-codemod/src/v6.0.0/pickers/text-props-to-localeText/text-props-to-localeText.test.ts index 1c83bbcd85e66..991026961a1fa 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/text-props-to-localeText/text-props-to-localeText.test.js +++ b/packages/x-codemod/src/v6.0.0/pickers/text-props-to-localeText/text-props-to-localeText.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/view-components-rename-value-prop/view-components-rename-value-prop.test.ts b/packages/x-codemod/src/v6.0.0/pickers/view-components-rename-value-prop/view-components-rename-value-prop.test.ts index 712054c21ddad..d613b65ea0645 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/view-components-rename-value-prop/view-components-rename-value-prop.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/view-components-rename-value-prop/view-components-rename-value-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/pickers/view-components-rename/view-components-rename.test.ts b/packages/x-codemod/src/v6.0.0/pickers/view-components-rename/view-components-rename.test.ts index 6ad973056d03e..1e3cd1ada006b 100644 --- a/packages/x-codemod/src/v6.0.0/pickers/view-components-rename/view-components-rename.test.ts +++ b/packages/x-codemod/src/v6.0.0/pickers/view-components-rename/view-components-rename.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v6.0.0/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v6.0.0/preset-safe/preset-safe.test.ts index d77b88fa65564..73c53ae87c571 100644 --- a/packages/x-codemod/src/v6.0.0/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v6.0.0/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/data-grid/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v7.0.0/data-grid/preset-safe/preset-safe.test.ts index 4dce7e1a6d4fa..aee53d5f93604 100644 --- a/packages/x-codemod/src/v7.0.0/data-grid/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v7.0.0/data-grid/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts b/packages/x-codemod/src/v7.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts index f0e8726f28e5c..66f383cb3e879 100644 --- a/packages/x-codemod/src/v7.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts +++ b/packages/x-codemod/src/v7.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/data-grid/rename-cell-selection-props/rename-cell-selection-props.test.ts b/packages/x-codemod/src/v7.0.0/data-grid/rename-cell-selection-props/rename-cell-selection-props.test.ts index 3e71d58babbde..be540631c5616 100644 --- a/packages/x-codemod/src/v7.0.0/data-grid/rename-cell-selection-props/rename-cell-selection-props.test.ts +++ b/packages/x-codemod/src/v7.0.0/data-grid/rename-cell-selection-props/rename-cell-selection-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/pickers/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v7.0.0/pickers/preset-safe/preset-safe.test.ts index 9bc0f80487395..f140c2bde44a0 100644 --- a/packages/x-codemod/src/v7.0.0/pickers/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v7.0.0/pickers/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/pickers/rename-day-picker-classes/rename-day-picker-classes.test.ts b/packages/x-codemod/src/v7.0.0/pickers/rename-day-picker-classes/rename-day-picker-classes.test.ts index 9d4f5e58fb1b2..1020096aebdca 100644 --- a/packages/x-codemod/src/v7.0.0/pickers/rename-day-picker-classes/rename-day-picker-classes.test.ts +++ b/packages/x-codemod/src/v7.0.0/pickers/rename-day-picker-classes/rename-day-picker-classes.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/pickers/rename-default-calendar-month-to-reference-date/rename-default-calendar-month-to-reference-date.test.ts b/packages/x-codemod/src/v7.0.0/pickers/rename-default-calendar-month-to-reference-date/rename-default-calendar-month-to-reference-date.test.ts index 859a66b2f1c8f..74f33b8e1f774 100644 --- a/packages/x-codemod/src/v7.0.0/pickers/rename-default-calendar-month-to-reference-date/rename-default-calendar-month-to-reference-date.test.ts +++ b/packages/x-codemod/src/v7.0.0/pickers/rename-default-calendar-month-to-reference-date/rename-default-calendar-month-to-reference-date.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/pickers/rename-slots-types/rename-slots-types.test.ts b/packages/x-codemod/src/v7.0.0/pickers/rename-slots-types/rename-slots-types.test.ts index ab225e56e8620..8420a46639a3e 100644 --- a/packages/x-codemod/src/v7.0.0/pickers/rename-slots-types/rename-slots-types.test.ts +++ b/packages/x-codemod/src/v7.0.0/pickers/rename-slots-types/rename-slots-types.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v7.0.0/preset-safe/preset-safe.test.ts index 3db400316a841..df733db43c58f 100644 --- a/packages/x-codemod/src/v7.0.0/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v7.0.0/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/preset-safe/preset-safe.test.ts index 215aed2c551ac..b6990ed5dcb68 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/rename-expansion-props/rename-expansion-props.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/rename-expansion-props/rename-expansion-props.test.ts index 3b0c1704abe72..b942657c281da 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/rename-expansion-props/rename-expansion-props.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/rename-expansion-props/rename-expansion-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/rename-focus-callback/rename-focus-callback.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/rename-focus-callback/rename-focus-callback.test.ts index 8fc3f69465835..a60d4cc5a9540 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/rename-focus-callback/rename-focus-callback.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/rename-focus-callback/rename-focus-callback.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/rename-nodeid/rename-nodeid.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/rename-nodeid/rename-nodeid.test.ts index b7a26874e3bd5..bea3bbb99a362 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/rename-nodeid/rename-nodeid.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/rename-nodeid/rename-nodeid.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/rename-selection-props/rename-selection-props.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/rename-selection-props/rename-selection-props.test.ts index c05b33b203f0d..b9052a137e22b 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/rename-selection-props/rename-selection-props.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/rename-selection-props/rename-selection-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/rename-tree-view-simple-tree-view/rename-tree-view-simple-tree-view.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/rename-tree-view-simple-tree-view/rename-tree-view-simple-tree-view.test.ts index e725ecac9e4c1..6078db4521dcc 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/rename-tree-view-simple-tree-view/rename-tree-view-simple-tree-view.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/rename-tree-view-simple-tree-view/rename-tree-view-simple-tree-view.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/rename-use-tree-item/rename-use-tree-item.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/rename-use-tree-item/rename-use-tree-item.test.ts index ef6c516cbd424..541831c27f247 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/rename-use-tree-item/rename-use-tree-item.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/rename-use-tree-item/rename-use-tree-item.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v7.0.0/tree-view/replace-transition-props-by-slot/replace-transition-props-by-slot.test.ts b/packages/x-codemod/src/v7.0.0/tree-view/replace-transition-props-by-slot/replace-transition-props-by-slot.test.ts index bfa542087e511..6777c8fd8ec2e 100644 --- a/packages/x-codemod/src/v7.0.0/tree-view/replace-transition-props-by-slot/replace-transition-props-by-slot.test.ts +++ b/packages/x-codemod/src/v7.0.0/tree-view/replace-transition-props-by-slot/replace-transition-props-by-slot.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/preset-safe/actual.spec.tsx b/packages/x-codemod/src/v8.0.0/charts/preset-safe/actual.spec.tsx index 9d11a9e8ebe94..c6b05cb8ccd5e 100644 --- a/packages/x-codemod/src/v8.0.0/charts/preset-safe/actual.spec.tsx +++ b/packages/x-codemod/src/v8.0.0/charts/preset-safe/actual.spec.tsx @@ -1,5 +1,4 @@ // @ts-nocheck -// eslint-disable-next-line /* eslint-disable */ import * as React from 'react'; import { PieChart } from '@mui/x-charts/PieChart'; diff --git a/packages/x-codemod/src/v8.0.0/charts/preset-safe/expected.spec.tsx b/packages/x-codemod/src/v8.0.0/charts/preset-safe/expected.spec.tsx index ea7be95314ca5..b69837a15cba4 100644 --- a/packages/x-codemod/src/v8.0.0/charts/preset-safe/expected.spec.tsx +++ b/packages/x-codemod/src/v8.0.0/charts/preset-safe/expected.spec.tsx @@ -1,5 +1,4 @@ // @ts-nocheck -// eslint-disable-next-line /* eslint-disable */ import * as React from 'react'; import { PieChart } from '@mui/x-charts/PieChart'; diff --git a/packages/x-codemod/src/v8.0.0/charts/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v8.0.0/charts/preset-safe/preset-safe.test.ts index 95b4e3f0d69be..618f053cf9012 100644 --- a/packages/x-codemod/src/v8.0.0/charts/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/remove-experimental-mark-rendering/remove-experimental-mark-rendering.test.ts b/packages/x-codemod/src/v8.0.0/charts/remove-experimental-mark-rendering/remove-experimental-mark-rendering.test.ts index 26b9f364307c5..0b250e8e7f489 100644 --- a/packages/x-codemod/src/v8.0.0/charts/remove-experimental-mark-rendering/remove-experimental-mark-rendering.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/remove-experimental-mark-rendering/remove-experimental-mark-rendering.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/remove-on-axis-click-handler/remove-on-axis-click-handler.test.ts b/packages/x-codemod/src/v8.0.0/charts/remove-on-axis-click-handler/remove-on-axis-click-handler.test.ts index 083165a90e2a0..8f41efc6723c3 100644 --- a/packages/x-codemod/src/v8.0.0/charts/remove-on-axis-click-handler/remove-on-axis-click-handler.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/remove-on-axis-click-handler/remove-on-axis-click-handler.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/rename-label-and-tick-font-size/rename-label-and-tick-font-size.test.ts b/packages/x-codemod/src/v8.0.0/charts/rename-label-and-tick-font-size/rename-label-and-tick-font-size.test.ts index 9a30655959da8..01ef57e4fc7ac 100644 --- a/packages/x-codemod/src/v8.0.0/charts/rename-label-and-tick-font-size/rename-label-and-tick-font-size.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/rename-label-and-tick-font-size/rename-label-and-tick-font-size.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/rename-legend-position-type/rename-legend-position-type.test.ts b/packages/x-codemod/src/v8.0.0/charts/rename-legend-position-type/rename-legend-position-type.test.ts index 0684c15eaab1d..d7270fc52b44d 100644 --- a/packages/x-codemod/src/v8.0.0/charts/rename-legend-position-type/rename-legend-position-type.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/rename-legend-position-type/rename-legend-position-type.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/rename-responsive-chart-container/rename-responsive-chart-container.test.ts b/packages/x-codemod/src/v8.0.0/charts/rename-responsive-chart-container/rename-responsive-chart-container.test.ts index 9ab2e4a9f5584..87ebe97cc200e 100644 --- a/packages/x-codemod/src/v8.0.0/charts/rename-responsive-chart-container/rename-responsive-chart-container.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/rename-responsive-chart-container/rename-responsive-chart-container.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/rename-sparkline-colors-to-color/rename-sparkline-colors-to-color.test.ts b/packages/x-codemod/src/v8.0.0/charts/rename-sparkline-colors-to-color/rename-sparkline-colors-to-color.test.ts index 94a5ee5813912..aec26abf53155 100644 --- a/packages/x-codemod/src/v8.0.0/charts/rename-sparkline-colors-to-color/rename-sparkline-colors-to-color.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/rename-sparkline-colors-to-color/rename-sparkline-colors-to-color.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/replace-legend-direction-values/replace-legend-direction-values.test.ts b/packages/x-codemod/src/v8.0.0/charts/replace-legend-direction-values/replace-legend-direction-values.test.ts index 9a30655959da8..01ef57e4fc7ac 100644 --- a/packages/x-codemod/src/v8.0.0/charts/replace-legend-direction-values/replace-legend-direction-values.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/replace-legend-direction-values/replace-legend-direction-values.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/replace-legend-hidden-slot-prop/replace-legend-hidden-slot-prop.test.ts b/packages/x-codemod/src/v8.0.0/charts/replace-legend-hidden-slot-prop/replace-legend-hidden-slot-prop.test.ts index 44eaef9d551ab..aaffb9c01ae92 100644 --- a/packages/x-codemod/src/v8.0.0/charts/replace-legend-hidden-slot-prop/replace-legend-hidden-slot-prop.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/replace-legend-hidden-slot-prop/replace-legend-hidden-slot-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/charts/replace-legend-position-values/replace-legend-position-values.test.ts b/packages/x-codemod/src/v8.0.0/charts/replace-legend-position-values/replace-legend-position-values.test.ts index fd81bfe98090a..60f2a48540825 100644 --- a/packages/x-codemod/src/v8.0.0/charts/replace-legend-position-values/replace-legend-position-values.test.ts +++ b/packages/x-codemod/src/v8.0.0/charts/replace-legend-position-values/replace-legend-position-values.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/add-showToolbar-prop/add-showToolbar-prop.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/add-showToolbar-prop/add-showToolbar-prop.test.ts index 6e6735de066c9..a7e79c6025b02 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/add-showToolbar-prop/add-showToolbar-prop.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/add-showToolbar-prop/add-showToolbar-prop.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/preset-safe/preset-safe.test.ts index 9af3bd0f15eb5..815c981fdd6e2 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/reform-row-selection-model/reform-row-selection-model.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/reform-row-selection-model/reform-row-selection-model.test.ts index eac72ef7d6448..41d20008af2f1 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/reform-row-selection-model/reform-row-selection-model.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/reform-row-selection-model/reform-row-selection-model.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/remove-props/remove-props.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/remove-props/remove-props.test.ts index fc89f05a0bb31..7cfbee3983e18 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/remove-props/remove-props.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/remove-props/remove-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts index b9caedfb5f684..ca5bfea098ff3 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/remove-stabilized-experimentalFeatures/remove-stabilized-experimentalFeatures.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/rename-imports/rename-imports.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/rename-imports/rename-imports.test.ts index 8680154039345..f997339191b57 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/rename-imports/rename-imports.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/rename-imports/rename-imports.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/rename-package/rename-package.ts b/packages/x-codemod/src/v8.0.0/data-grid/rename-package/rename-package.ts index b9d77ed7f1f3c..2265027d7c648 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/rename-package/rename-package.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/rename-package/rename-package.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/data-grid/rename-props/rename-props.test.ts b/packages/x-codemod/src/v8.0.0/data-grid/rename-props/rename-props.test.ts index c0479dc4473b8..d8604d40d7ec4 100644 --- a/packages/x-codemod/src/v8.0.0/data-grid/rename-props/rename-props.test.ts +++ b/packages/x-codemod/src/v8.0.0/data-grid/rename-props/rename-props.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/pickers/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v8.0.0/pickers/preset-safe/preset-safe.test.ts index 5129efe68f31b..c9751151962a1 100644 --- a/packages/x-codemod/src/v8.0.0/pickers/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v8.0.0/pickers/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/pickers/rename-adapter-date-fns-imports/rename-adapter-date-fns-imports.test.ts b/packages/x-codemod/src/v8.0.0/pickers/rename-adapter-date-fns-imports/rename-adapter-date-fns-imports.test.ts index adf48ace48983..3f84fb155da1d 100644 --- a/packages/x-codemod/src/v8.0.0/pickers/rename-adapter-date-fns-imports/rename-adapter-date-fns-imports.test.ts +++ b/packages/x-codemod/src/v8.0.0/pickers/rename-adapter-date-fns-imports/rename-adapter-date-fns-imports.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/pickers/rename-type-imports/rename-imports.test.ts b/packages/x-codemod/src/v8.0.0/pickers/rename-type-imports/rename-imports.test.ts index 43866d2b7d793..ade1d5eb828f3 100644 --- a/packages/x-codemod/src/v8.0.0/pickers/rename-type-imports/rename-imports.test.ts +++ b/packages/x-codemod/src/v8.0.0/pickers/rename-type-imports/rename-imports.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v8.0.0/preset-safe/preset-safe.test.ts index 90a28d50b7c82..05ba10d9d45e5 100644 --- a/packages/x-codemod/src/v8.0.0/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v8.0.0/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import fs from 'fs'; import transform from '.'; diff --git a/packages/x-codemod/src/v8.0.0/tree-view/preset-safe/preset-safe.test.ts b/packages/x-codemod/src/v8.0.0/tree-view/preset-safe/preset-safe.test.ts index 7f61d9c0e721e..775a35f5a1118 100644 --- a/packages/x-codemod/src/v8.0.0/tree-view/preset-safe/preset-safe.test.ts +++ b/packages/x-codemod/src/v8.0.0/tree-view/preset-safe/preset-safe.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from './index'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/src/v8.0.0/tree-view/rename-tree-item-2/rename-tree-item-2.test.ts b/packages/x-codemod/src/v8.0.0/tree-view/rename-tree-item-2/rename-tree-item-2.test.ts index 5c1a20580711c..e0dbe1beed29e 100644 --- a/packages/x-codemod/src/v8.0.0/tree-view/rename-tree-item-2/rename-tree-item-2.test.ts +++ b/packages/x-codemod/src/v8.0.0/tree-view/rename-tree-item-2/rename-tree-item-2.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { expect } from 'chai'; import jscodeshift from 'jscodeshift'; import transform from '.'; import readFile from '../../../util/readFile'; diff --git a/packages/x-codemod/tsconfig.json b/packages/x-codemod/tsconfig.json index 97636e2180272..6384ca933e6a8 100644 --- a/packages/x-codemod/tsconfig.json +++ b/packages/x-codemod/tsconfig.json @@ -4,16 +4,15 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", "dayjs/plugin/timezone.d.ts", "dayjs/plugin/utc.d.ts", - "mocha", + "vitest/globals", "moment-timezone", "node" ], "noImplicitAny": false, "skipLibCheck": true }, - "include": ["src/**/*"], + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"], "exclude": ["src/**/actual*.ts*"] } diff --git a/packages/x-data-grid-generator/tsconfig.json b/packages/x-data-grid-generator/tsconfig.json index 5b674a6fce636..e55341b154a03 100644 --- a/packages/x-data-grid-generator/tsconfig.json +++ b/packages/x-data-grid-generator/tsconfig.json @@ -4,11 +4,11 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node", "react" - ] + ], + "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-data-grid-premium/src/tests/DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/DataGridPremium.test.tsx index 0e70ff301d4c2..47ee194832a8b 100644 --- a/packages/x-data-grid-premium/src/tests/DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/DataGridPremium.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { createRenderer, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGridPremium as DataGrid, DataGridPremiumProps as DataGridProps, diff --git a/packages/x-data-grid-premium/src/tests/aggregation.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/aggregation.DataGridPremium.test.tsx index 5fb8afae18476..7d5931d9a97fa 100644 --- a/packages/x-data-grid-premium/src/tests/aggregation.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/aggregation.DataGridPremium.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { createRenderer, screen, within, act, fireEvent } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { getCell, getColumnHeaderCell, getColumnValues } from 'test/utils/helperFn'; import { fireUserEvent } from 'test/utils/fireUserEvent'; import { SinonSpy, spy } from 'sinon'; diff --git a/packages/x-data-grid-premium/src/tests/aiAssistant.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/aiAssistant.DataGridPremium.test.tsx index da5d8e7610052..6ebc45d455768 100644 --- a/packages/x-data-grid-premium/src/tests/aiAssistant.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/aiAssistant.DataGridPremium.test.tsx @@ -2,7 +2,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { act, createRenderer, screen } from '@mui/internal-test-utils'; import { spy, stub } from 'sinon'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps, @@ -11,7 +10,7 @@ import { GridRowsProp, useGridApiRef, } from '@mui/x-data-grid-premium'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; interface BaselineProps extends DataGridPremiumProps { rows: GridRowsProp; @@ -74,7 +73,7 @@ describe(' - Prompt', () => { promptSpy.reset(); }); - describeSkipIf(isJSDOM)('data sampling', () => { + describe.skipIf(isJSDOM)('data sampling', () => { it('should not show AI Assistant button in the Toolbarif the feature is disabled', () => { render(); expect(screen.queryByTestId('AssistantIcon')).to.equal(null); diff --git a/packages/x-data-grid-premium/src/tests/cellSelection.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/cellSelection.DataGridPremium.test.tsx index 0e6e2018c03e0..7b1714f7204e6 100644 --- a/packages/x-data-grid-premium/src/tests/cellSelection.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/cellSelection.DataGridPremium.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { stub, SinonStub, spy } from 'sinon'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { spyApi, getCell, grid } from 'test/utils/helperFn'; import { createRenderer, act, screen, waitFor } from '@mui/internal-test-utils'; @@ -12,7 +11,7 @@ import { gridClasses, } from '@mui/x-data-grid-premium'; import { getBasicGridData } from '@mui/x-data-grid-generator'; -import { isJSDOM, describeSkipIf } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Cell selection', () => { const { render } = createRenderer(); @@ -380,7 +379,7 @@ describe(' - Cell selection', () => { }); // JSDOM doesn't support scroll events - describeSkipIf(isJSDOM)('Auto-scroll', () => { + describe.skipIf(isJSDOM)('Auto-scroll', () => { beforeEach(() => { stub(window, 'requestAnimationFrame').callsFake(() => 0); }); diff --git a/packages/x-data-grid-premium/src/tests/clipboard.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/clipboard.DataGridPremium.test.tsx index f2a65d4361a29..c52521c65d09b 100644 --- a/packages/x-data-grid-premium/src/tests/clipboard.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/clipboard.DataGridPremium.test.tsx @@ -8,11 +8,10 @@ import { GridColDef, } from '@mui/x-data-grid-premium'; import { act, createRenderer, fireEvent, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { SinonSpy, spy, stub, SinonStub } from 'sinon'; import { getCell, getColumnValues, includeRowSelection, sleep } from 'test/utils/helperFn'; import { getBasicGridData } from '@mui/x-data-grid-generator'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Clipboard', () => { const { render } = createRenderer(); @@ -170,7 +169,7 @@ describe(' - Clipboard', () => { }); // These test are flaky in JSDOM - describeSkipIf(isJSDOM)('paste', () => { + describe.skipIf(isJSDOM)('paste', () => { function paste(cell: HTMLElement, pasteText: string) { const pasteEvent = new Event('paste'); diff --git a/packages/x-data-grid-premium/src/tests/columns.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/columns.DataGridPremium.test.tsx index b380acbe3ce27..f8e3240b0e7fc 100644 --- a/packages/x-data-grid-premium/src/tests/columns.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/columns.DataGridPremium.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; import { act, createRenderer, fireEvent } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGridPremium, gridClasses } from '@mui/x-data-grid-premium'; import { getCell, getColumnHeaderCell } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Columns', () => { const { render } = createRenderer(); @@ -11,7 +10,7 @@ describe(' - Columns', () => { describe('resizing', () => { // https://github.com/mui/mui-x/issues/10078 // Needs layout - testSkipIf(isJSDOM)('should properly resize aggregated column', () => { + it.skipIf(isJSDOM)('should properly resize aggregated column', () => { render(
- Data source aggregation', () => { +describe.skipIf(isJSDOM)(' - Data source aggregation', () => { const { render } = createRenderer(); let apiRef: RefObject; @@ -99,7 +98,6 @@ describeSkipIf(isJSDOM)(' - Data source aggregation', () => { } // TODO @MBilalShafi: Flaky test, fix it - // eslint-disable-next-line mocha/no-skipped-tests it.skip('should show aggregation option in the column menu', async () => { const dataSource = { getRows: async () => { diff --git a/packages/x-data-grid-premium/src/tests/exportExcel.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/exportExcel.DataGridPremium.test.tsx index aafeda105b271..061e1ef1917ae 100644 --- a/packages/x-data-grid-premium/src/tests/exportExcel.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/exportExcel.DataGridPremium.test.tsx @@ -10,7 +10,6 @@ import { } from '@mui/x-data-grid-premium'; import { createRenderer, screen, act } from '@mui/internal-test-utils'; import { spy, SinonSpy } from 'sinon'; -import { expect } from 'chai'; import Excel from 'exceljs'; import { spyApi } from 'test/utils/helperFn'; diff --git a/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx index 873a63be4beeb..3311352c421e1 100644 --- a/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/license.DataGridPremium.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { addYears } from 'date-fns/addYears'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { DataGridPremium } from '@mui/x-data-grid-premium'; import { generateLicense, LicenseInfo } from '@mui/x-license'; diff --git a/packages/x-data-grid-premium/src/tests/pivoting.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/pivoting.DataGridPremium.test.tsx index 67159b59c416f..d1ba97f50fa4b 100644 --- a/packages/x-data-grid-premium/src/tests/pivoting.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/pivoting.DataGridPremium.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { act, createRenderer, screen, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps, diff --git a/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx index 89b787e8615d6..3db3258213a92 100644 --- a/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx @@ -11,7 +11,6 @@ import { getRow, sleep, } from 'test/utils/helperFn'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps, diff --git a/packages/x-data-grid-premium/src/tests/rowGroupingApiRef.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowGroupingApiRef.DataGridPremium.test.tsx index a13cbc118603f..f8aaeb1b00086 100644 --- a/packages/x-data-grid-premium/src/tests/rowGroupingApiRef.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowGroupingApiRef.DataGridPremium.test.tsx @@ -10,7 +10,6 @@ import { useGridApiRef, getGroupRowIdFromPath, } from '@mui/x-data-grid-premium'; -import { expect } from 'chai'; import { isJSDOM } from 'test/utils/skipIf'; interface BaselineProps extends DataGridPremiumProps { diff --git a/packages/x-data-grid-premium/src/tests/rowGroupingProp.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowGroupingProp.DataGridPremium.test.tsx index 19fd5f48dad50..d5bb2c946e9e5 100644 --- a/packages/x-data-grid-premium/src/tests/rowGroupingProp.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowGroupingProp.DataGridPremium.test.tsx @@ -8,7 +8,6 @@ import { getCell, } from 'test/utils/helperFn'; import { fireUserEvent } from 'test/utils/fireUserEvent'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps, diff --git a/packages/x-data-grid-premium/src/tests/rowPinning.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowPinning.DataGridPremium.test.tsx index 21e39ae1db280..4016aaa121c3d 100644 --- a/packages/x-data-grid-premium/src/tests/rowPinning.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowPinning.DataGridPremium.test.tsx @@ -1,6 +1,5 @@ import { createRenderer } from '@mui/internal-test-utils'; import * as React from 'react'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps, diff --git a/packages/x-data-grid-premium/src/tests/rowSelection.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowSelection.DataGridPremium.test.tsx index b5c6d5edc2b99..b618f06cd25d8 100644 --- a/packages/x-data-grid-premium/src/tests/rowSelection.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowSelection.DataGridPremium.test.tsx @@ -3,7 +3,6 @@ import { RefObject } from '@mui/x-internals/types'; import { act, createRenderer, fireEvent } from '@mui/internal-test-utils'; import { getCell, includeRowSelection } from 'test/utils/helperFn'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps, @@ -213,7 +212,6 @@ describe(' - Row selection', () => { }); // Use case yet to be supported - // eslint-disable-next-line mocha/no-skipped-tests describe.skip('prop: keepNonExistentRowsSelected', () => { it('should auto select the parent of a previously selected non existent rows when it is added back', () => { const onRowSelectionModelChange = spy(); diff --git a/packages/x-data-grid-premium/src/tests/rowSpanning.DataGridPremium.test.tsx b/packages/x-data-grid-premium/src/tests/rowSpanning.DataGridPremium.test.tsx index f69405f42ddfc..31f0d4adf82dc 100644 --- a/packages/x-data-grid-premium/src/tests/rowSpanning.DataGridPremium.test.tsx +++ b/packages/x-data-grid-premium/src/tests/rowSpanning.DataGridPremium.test.tsx @@ -1,8 +1,7 @@ import * as React from 'react'; import { createRenderer } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGridPremium, DataGridPremiumProps } from '@mui/x-data-grid-premium'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Row spanning', () => { const { render } = createRenderer(); @@ -108,7 +107,7 @@ describe(' - Row spanning', () => { } // See https://github.com/mui/mui-x/issues/14691 - testSkipIf(isJSDOM)('should not throw when initializing an aggregation model', () => { + it.skipIf(isJSDOM)('should not throw when initializing an aggregation model', () => { expect(() => render( - Accessibility', () => { const { render } = createRenderer(); diff --git a/packages/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx index 7088c1704f06e..7eb4cbc8d472c 100644 --- a/packages/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/cellEditing.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { diff --git a/packages/x-data-grid-pro/src/tests/clipboard.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/clipboard.DataGridPro.test.tsx index c01f7129d67ae..711536d9e960e 100644 --- a/packages/x-data-grid-pro/src/tests/clipboard.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/clipboard.DataGridPro.test.tsx @@ -2,7 +2,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { GridApi, useGridApiRef, DataGridPro, DataGridProProps } from '@mui/x-data-grid-pro'; import { createRenderer, fireEvent, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { SinonSpy, spy } from 'sinon'; import { getCell } from 'test/utils/helperFn'; import { fireUserEvent } from 'test/utils/fireUserEvent'; diff --git a/packages/x-data-grid-pro/src/tests/columnHeaders.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/columnHeaders.DataGridPro.test.tsx index 60a4d5b3d6eeb..3783e983da28c 100644 --- a/packages/x-data-grid-pro/src/tests/columnHeaders.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/columnHeaders.DataGridPro.test.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; import { config } from 'react-transition-group'; import { act, createRenderer, fireEvent, screen } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { gridClasses, DataGridPro, DataGridProProps } from '@mui/x-data-grid-pro'; import { getColumnHeaderCell, getColumnValues } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { vi } from 'vitest'; describe(' - Column headers', () => { @@ -33,7 +32,7 @@ describe(' - Column headers', () => { }; // JSDOM version of .focus() doesn't scroll - testSkipIf(isJSDOM)('should not scroll the column headers when a column is focused', async () => { + it.skipIf(isJSDOM)('should not scroll the column headers when a column is focused', async () => { render(
- Column pinning', () => { window.ResizeObserver = originalResizeObserver; }); - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should scroll when the next cell to focus is covered by the left pinned columns', () => { render(); @@ -110,7 +109,7 @@ describe(' - Column pinning', () => { }, ); - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should scroll when the next cell to focus is covered by the right pinned columns', () => { render(); @@ -123,7 +122,7 @@ describe(' - Column pinning', () => { }, ); - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should increase the width of right pinned columns by resizing to the left', () => { render(); @@ -142,7 +141,7 @@ describe(' - Column pinning', () => { }, ); - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should reduce the width of right pinned columns by resizing to the right', () => { render(); @@ -212,7 +211,7 @@ describe(' - Column pinning', () => { }); // Doesn't work with mocked window.getComputedStyle - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should add border to right pinned columns section when `showCellVerticalBorder={true}`', () => { render( @@ -233,7 +232,7 @@ describe(' - Column pinning', () => { ); // https://github.com/mui/mui-x/issues/12431 - testSkipIf(isJSDOM)('should not render unnecessary filler after the last row', () => { + it.skipIf(isJSDOM)('should not render unnecessary filler after the last row', () => { const rowHeight = 50; const columns: GridColDef[] = [ { field: 'id', headerName: 'ID', width: 120 }, diff --git a/packages/x-data-grid-pro/src/tests/columnReorder.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/columnReorder.DataGridPro.test.tsx index 8d7820af7823e..b7039024152b0 100644 --- a/packages/x-data-grid-pro/src/tests/columnReorder.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/columnReorder.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { createRenderer, fireEvent, createEvent, act } from '@mui/internal-test-utils'; import { diff --git a/packages/x-data-grid-pro/src/tests/columnSpanning.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/columnSpanning.DataGridPro.test.tsx index 4c93dbdadb4e9..ab24e5e7618c2 100644 --- a/packages/x-data-grid-pro/src/tests/columnSpanning.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/columnSpanning.DataGridPro.test.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; import { createRenderer, fireEvent, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { DataGridPro, GridApi, useGridApiRef, GridColDef, gridClasses } from '@mui/x-data-grid-pro'; import { getActiveCell, getCell, getColumnHeaderCell } from 'test/utils/helperFn'; import { fireUserEvent } from 'test/utils/fireUserEvent'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Column spanning', () => { const { render } = createRenderer(); @@ -37,7 +36,7 @@ describe(' - Column spanning', () => { }; // Need layouting - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not apply `colSpan` in pinned columns section if there is only one column there', () => { render( @@ -155,7 +154,7 @@ describe(' - Column spanning', () => { }); // Need layouting - testSkipIf(isJSDOM)('should work with column resizing', () => { + it.skipIf(isJSDOM)('should work with column resizing', () => { const columns = [{ field: 'brand', colSpan: 2 }, { field: 'category' }, { field: 'price' }]; render( diff --git a/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx index 3064e4c1e54ee..0a9a8eaeca8ea 100644 --- a/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { createRenderer, fireEvent, screen, act, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { @@ -15,7 +14,7 @@ import { } from '@mui/x-data-grid-pro'; import { useGridPrivateApiContext } from '@mui/x-data-grid-pro/internals'; import { getColumnHeaderCell, getCell, getRow } from 'test/utils/helperFn'; -import { describeSkipIf, testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Columns', () => { const { render } = createRenderer(); @@ -78,7 +77,7 @@ describe(' - Columns', () => { }); // Need layouting - describeSkipIf(isJSDOM)('resizing', () => { + describe.skipIf(isJSDOM)('resizing', () => { const columns = [{ field: 'brand', width: 100 }]; it('should allow to resize columns with the mouse', () => { @@ -92,25 +91,22 @@ describe(' - Columns', () => { }); // Only run in supported browsers - testSkipIf(typeof Touch === 'undefined')( - 'should allow to resize columns with the touch', - () => { - render(); - const separator = document.querySelector(`.${gridClasses['columnSeparator--resizable']}`)!; - const now = Date.now(); - fireEvent.touchStart(separator, { - changedTouches: [new Touch({ identifier: now, target: separator, clientX: 100 })], - }); - fireEvent.touchMove(separator, { - changedTouches: [new Touch({ identifier: now, target: separator, clientX: 110 })], - }); - fireEvent.touchEnd(separator, { - changedTouches: [new Touch({ identifier: now, target: separator, clientX: 110 })], - }); - expect(getColumnHeaderCell(0)).toHaveInlineStyle({ width: '110px' }); - expect(getCell(1, 0).getBoundingClientRect().width).to.equal(110); - }, - ); + it.skipIf(typeof Touch === 'undefined')('should allow to resize columns with the touch', () => { + render(); + const separator = document.querySelector(`.${gridClasses['columnSeparator--resizable']}`)!; + const now = Date.now(); + fireEvent.touchStart(separator, { + changedTouches: [new Touch({ identifier: now, target: separator, clientX: 100 })], + }); + fireEvent.touchMove(separator, { + changedTouches: [new Touch({ identifier: now, target: separator, clientX: 110 })], + }); + fireEvent.touchEnd(separator, { + changedTouches: [new Touch({ identifier: now, target: separator, clientX: 110 })], + }); + expect(getColumnHeaderCell(0)).toHaveInlineStyle({ width: '110px' }); + expect(getCell(1, 0).getBoundingClientRect().width).to.equal(110); + }); it('should call onColumnResize during resizing', async () => { const onColumnResize = spy(); @@ -366,7 +362,7 @@ describe(' - Columns', () => { }); // Need layouting - describeSkipIf(isJSDOM)('flex resizing', () => { + describe.skipIf(isJSDOM)('flex resizing', () => { it('should resize the flex width after resizing another column with api', () => { const twoColumns = [ { field: 'id', width: 100, flex: 1 }, @@ -557,7 +553,7 @@ describe(' - Columns', () => { }); // Need layouting - describeSkipIf(isJSDOM)('autosizing', () => { + describe.skipIf(isJSDOM)('autosizing', () => { const rows = [ { id: 0, brand: 'Nike' }, { id: 1, brand: 'Adidas' }, @@ -714,7 +710,7 @@ describe(' - Columns', () => { }); }); - describeSkipIf(isJSDOM)('flex columns with pinned columns', () => { + describe.skipIf(isJSDOM)('flex columns with pinned columns', () => { it('should maintain correct widths and positions when flex columns are set', () => { render( - Data source lazy loader', () => { +describe.skipIf(isJSDOM)(' - Data source lazy loader', () => { const { render } = createRenderer(); const defaultTransformGetRowsResponse = (response: GridGetRowsResponse) => response; const fetchRowsSpy = spy(); @@ -102,7 +101,6 @@ describeSkipIf(isJSDOM)(' - Data source lazy loader', () => { ); } - // eslint-disable-next-line mocha/no-top-level-hooks beforeEach(() => { transformGetRowsResponse = defaultTransformGetRowsResponse; }); diff --git a/packages/x-data-grid-pro/src/tests/dataSourceTreeData.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/dataSourceTreeData.DataGridPro.test.tsx index b5b71134f2bd2..87d38aec6e9ac 100644 --- a/packages/x-data-grid-pro/src/tests/dataSourceTreeData.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/dataSourceTreeData.DataGridPro.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { useMockServer } from '@mui/x-data-grid-generator'; import { act, createRenderer, waitFor, within } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { DataGridPro, @@ -15,7 +14,7 @@ import { } from '@mui/x-data-grid-pro'; import { spy } from 'sinon'; import { getCell } from 'test/utils/helperFn'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const dataSetOptions = { dataSet: 'Employee' as const, @@ -28,7 +27,7 @@ const pageSizeOptions = [5, 10, 50]; const serverOptions = { minDelay: 0, maxDelay: 0, verbose: false }; // Needs layout -describeSkipIf(isJSDOM)(' - Data source tree data', () => { +describe.skipIf(isJSDOM)(' - Data source tree data', () => { const { render } = createRenderer(); const fetchRowsSpy = spy(); diff --git a/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx index 4585ee7969285..1fa182356c09d 100644 --- a/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { @@ -14,7 +13,7 @@ import { import { useBasicDemoData } from '@mui/x-data-grid-generator'; import { createRenderer, screen, waitFor, act, reactMajor } from '@mui/internal-test-utils'; import { $, $$, grid, getRow, getCell, getColumnValues } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Detail panel', () => { const { render } = createRenderer(); @@ -32,7 +31,7 @@ describe(' - Detail panel', () => { } // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not allow to expand rows that do not specify a detail element', async () => { const { user } = render( @@ -46,7 +45,7 @@ describe(' - Detail panel', () => { ); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not consider the height of the detail panels when rendering new rows during scroll', async () => { const rowHeight = 50; @@ -79,7 +78,7 @@ describe(' - Detail panel', () => { ); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should derive the height from the content if getDetailPanelHeight returns "auto"', async () => { const rowHeight = 50; @@ -115,7 +114,7 @@ describe(' - Detail panel', () => { ); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should update the detail panel height if the content height changes when getDetailPanelHeight returns "auto"', async () => { function ExpandableCell() { @@ -166,7 +165,7 @@ describe(' - Detail panel', () => { ); // Doesn't work with mocked window.getComputedStyle - testSkipIf(isJSDOM)('should position correctly the detail panels', () => { + it.skipIf(isJSDOM)('should position correctly the detail panels', () => { const rowHeight = 50; const evenHeight = rowHeight; const oddHeight = 2 * rowHeight; @@ -211,7 +210,7 @@ describe(' - Detail panel', () => { }); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should consider the height of the detail panel when scrolling to a cell', async () => { const rowHeight = 50; @@ -240,7 +239,7 @@ describe(' - Detail panel', () => { ); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not scroll vertically when navigating expanded row cells', async () => { function Component() { @@ -387,7 +386,7 @@ describe(' - Detail panel', () => { }); // Doesn't work with mocked window.getComputedStyle - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should update the panel height if getDetailPanelHeight is changed while the panel is open', async () => { const getDetailPanelHeight = spy(() => 100); @@ -464,7 +463,7 @@ describe(' - Detail panel', () => { // See https://github.com/mui/mui-x/issues/4607 // Needs layout - testSkipIf(isJSDOM)('should make detail panel to take full width of the content', async () => { + it.skipIf(isJSDOM)('should make detail panel to take full width of the content', async () => { const { user } = render(
Detail
} @@ -491,7 +490,7 @@ describe(' - Detail panel', () => { // See https://github.com/mui/mui-x/issues/6694 // Doesn't work with mocked window.getComputedStyle - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should add a bottom margin to the expanded row when using `getRowSpacing`', async () => { const { user } = render( @@ -523,7 +522,7 @@ describe(' - Detail panel', () => { }); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( "should not render detail panel for the focused row if it's outside of the viewport", async () => { const { user } = render( diff --git a/packages/x-data-grid-pro/src/tests/editComponents.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/editComponents.DataGridPro.test.tsx index f729eaa61d1ba..273ae2924c480 100644 --- a/packages/x-data-grid-pro/src/tests/editComponents.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/editComponents.DataGridPro.test.tsx @@ -12,7 +12,6 @@ import { renderEditSingleSelectCell, } from '@mui/x-data-grid-pro'; import { act, createRenderer, screen, waitFor, within } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { getCell, spyApi, sleep } from 'test/utils/helperFn'; import { spy, SinonSpy } from 'sinon'; diff --git a/packages/x-data-grid-pro/src/tests/events.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/events.DataGridPro.test.tsx index 7848cd5b85d1c..97779198ea0a6 100644 --- a/packages/x-data-grid-pro/src/tests/events.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/events.DataGridPro.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { createRenderer, fireEvent, screen, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGridPro, GridColumnHeaderParams, @@ -18,7 +17,7 @@ import { } from '@mui/x-data-grid-pro'; import { getCell, getColumnHeaderCell, includeRowSelection } from 'test/utils/helperFn'; import { spy } from 'sinon'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Events params', () => { const { render } = createRenderer(); @@ -331,12 +330,9 @@ describe(' - Events params', () => { }); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'lazy loaded grid should load the rest of the rows when mounted when virtualization is disabled', - function test() { - if (isJSDOM) { - this.skip(); // Needs layout - } + () => { const handleFetchRows = spy(); render( - Filter', () => { const { render } = createRenderer(); @@ -666,7 +665,7 @@ describe(' - Filter', () => { }); // Needs layout - testSkipIf(isJSDOM)('should not scroll the page when a filter is removed from the panel', () => { + it.skipIf(isJSDOM)('should not scroll the page when a filter is removed from the panel', () => { render(
{/* To simulate a page that needs to be scrolled to reach the grid. */} @@ -698,7 +697,7 @@ describe(' - Filter', () => { }); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not scroll the page when opening the filter panel and the operator=isAnyOf', () => { render( @@ -916,7 +915,7 @@ describe(' - Filter', () => { }); // It's not re-rendering the filter panel correctly - testSkipIf(isJSDOM)('should give a stable ID to the filter item used as placeholder', () => { + it.skipIf(isJSDOM)('should give a stable ID to the filter item used as placeholder', () => { const { rerender } = render(); const filtersButton = screen.getByRole('button', { name: /Filters/i }); fireEvent.click(filtersButton); diff --git a/packages/x-data-grid-pro/src/tests/infiniteLoader.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/infiniteLoader.DataGridPro.test.tsx index 13fede1a0420b..1b9e83ee42b56 100644 --- a/packages/x-data-grid-pro/src/tests/infiniteLoader.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/infiniteLoader.DataGridPro.test.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; import { act, createRenderer, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGridPro } from '@mui/x-data-grid-pro'; import { spy, restore } from 'sinon'; import { getColumnValues } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Infinite loader', () => { afterEach(() => { @@ -14,7 +13,7 @@ describe(' - Infinite loader', () => { const { render } = createRenderer(); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should call `onRowsScrollEnd` when viewport scroll reaches the bottom', async () => { const baseRows = [ @@ -71,7 +70,7 @@ describe(' - Infinite loader', () => { ); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should call `onRowsScrollEnd` when there is not enough rows to cover the viewport height', async () => { const allRows = [ @@ -147,7 +146,7 @@ describe(' - Infinite loader', () => { ); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not observe intersections with the rows pinned to the bottom', async () => { const baseRows = [ diff --git a/packages/x-data-grid-pro/src/tests/layout.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/layout.DataGridPro.test.tsx index 6c07e8866a6a6..4275e08ad6ad2 100644 --- a/packages/x-data-grid-pro/src/tests/layout.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/layout.DataGridPro.test.tsx @@ -1,14 +1,13 @@ import * as React from 'react'; import { createRenderer, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import { GridApi, useGridApiRef, DataGridPro, DataGridProProps } from '@mui/x-data-grid-pro'; import { ptBR } from '@mui/x-data-grid-pro/locales'; import { grid } from 'test/utils/helperFn'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; -describeSkipIf(isJSDOM)(' - Layout', () => { +describe.skipIf(isJSDOM)(' - Layout', () => { const { render } = createRenderer(); const baselineProps = { diff --git a/packages/x-data-grid-pro/src/tests/lazyLoader.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/lazyLoader.DataGridPro.test.tsx index d0daf61cc05d4..56550f2285bae 100644 --- a/packages/x-data-grid-pro/src/tests/lazyLoader.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/lazyLoader.DataGridPro.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { createRenderer, fireEvent, act } from '@mui/internal-test-utils'; import { getColumnHeaderCell, getColumnValues, getRow } from 'test/utils/helperFn'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { DataGridPro, @@ -15,7 +14,7 @@ import { useGridApiRef, } from '@mui/x-data-grid-pro'; import { spy } from 'sinon'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Lazy loader', () => { const { render } = createRenderer(); @@ -58,7 +57,7 @@ describe(' - Lazy loader', () => { } // Needs layout - testSkipIf(isJSDOM)('should not call onFetchRows if the viewport is fully loaded', () => { + it.skipIf(isJSDOM)('should not call onFetchRows if the viewport is fully loaded', () => { const handleFetchRows = spy(); const rows = [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }, { id: 5 }, { id: 6 }, { id: 7 }]; render(); @@ -66,7 +65,7 @@ describe(' - Lazy loader', () => { }); // Needs layout - testSkipIf(isJSDOM)('should call onFetchRows when sorting is applied', () => { + it.skipIf(isJSDOM)('should call onFetchRows when sorting is applied', () => { const handleFetchRows = spy(); render(); @@ -77,7 +76,7 @@ describe(' - Lazy loader', () => { }); // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should render skeleton cell if rowCount is bigger than the number of rows', () => { render(); diff --git a/packages/x-data-grid-pro/src/tests/license.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/license.DataGridPro.test.tsx index be77d8d2634fa..94ceecaafba02 100644 --- a/packages/x-data-grid-pro/src/tests/license.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/license.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { DataGridPro } from '@mui/x-data-grid-pro'; import { LicenseInfo } from '@mui/x-license'; diff --git a/packages/x-data-grid-pro/src/tests/listView.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/listView.DataGridPro.test.tsx index 3b65c6346c916..9e8262e56ea84 100644 --- a/packages/x-data-grid-pro/src/tests/listView.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/listView.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { DataGridPro, diff --git a/packages/x-data-grid-pro/src/tests/pagination.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/pagination.DataGridPro.test.tsx index 05f9cc27c491c..659d375bcc57d 100644 --- a/packages/x-data-grid-pro/src/tests/pagination.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/pagination.DataGridPro.test.tsx @@ -2,7 +2,6 @@ import { createRenderer, act } from '@mui/internal-test-utils'; import { getColumnValues } from 'test/utils/helperFn'; import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; -import { expect } from 'chai'; import { DataGridPro, GridApi, useGridApiRef } from '@mui/x-data-grid-pro'; import { useBasicDemoData } from '@mui/x-data-grid-generator'; import { GridApiPro } from '../models/gridApiPro'; diff --git a/packages/x-data-grid-pro/src/tests/printExport.DataGrid.test.tsx b/packages/x-data-grid-pro/src/tests/printExport.DataGrid.test.tsx index 4d4a8811c6fa6..c31563362b364 100644 --- a/packages/x-data-grid-pro/src/tests/printExport.DataGrid.test.tsx +++ b/packages/x-data-grid-pro/src/tests/printExport.DataGrid.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { DataGridPro, GridApi, useGridApiRef, DataGridProProps } from '@mui/x-data-grid-pro'; diff --git a/packages/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx index 3c8a2ef14217e..d19bea16e9d79 100644 --- a/packages/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rowEditing.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { diff --git a/packages/x-data-grid-pro/src/tests/rowPinning.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rowPinning.DataGridPro.test.tsx index 8bbd135842e33..a31b076303562 100644 --- a/packages/x-data-grid-pro/src/tests/rowPinning.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rowPinning.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { @@ -24,7 +23,7 @@ import { getRows, microtasks, } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Row pinning', () => { const { render } = createRenderer(); @@ -122,7 +121,7 @@ describe(' - Row pinning', () => { }); // Needs layouting - testSkipIf(isJSDOM)('should keep rows pinned on rows scroll', async () => { + it.skipIf(isJSDOM)('should keep rows pinned on rows scroll', async () => { render(); const virtualScroller = document.querySelector(`.${gridClasses.virtualScroller}`)!; @@ -412,7 +411,7 @@ describe(' - Row pinning', () => { }); // Needs layouting - testSkipIf(isJSDOM)('should work with pinned columns', async () => { + it.skipIf(isJSDOM)('should work with pinned columns', async () => { function TestCase() { const data = getBasicGridData(5, 7); const [pinnedRow0, pinnedRow1, ...rows] = data.rows; @@ -477,7 +476,7 @@ describe(' - Row pinning', () => { }); // Needs layouting - testSkipIf(isJSDOM)('should work with variable row height', () => { + it.skipIf(isJSDOM)('should work with variable row height', () => { function TestCase() { return ( - Row pinning', () => { }); // Needs layouting - testSkipIf(isJSDOM)('should always update on `rowHeight` change', async () => { + it.skipIf(isJSDOM)('should always update on `rowHeight` change', async () => { const defaultRowHeight = 52; function TestCase({ rowHeight }: { rowHeight?: number }) { @@ -529,7 +528,7 @@ describe(' - Row pinning', () => { }); // Needs layouting - testSkipIf(isJSDOM)('should work with `autoHeight`', () => { + it.skipIf(isJSDOM)('should work with `autoHeight`', () => { const columnHeaderHeight = 56; const rowHeight = 52; const rowCount = 10; @@ -549,7 +548,7 @@ describe(' - Row pinning', () => { }); // Needs layouting - testSkipIf(isJSDOM)('should work with `autoPageSize`', () => { + it.skipIf(isJSDOM)('should work with `autoPageSize`', () => { render( - Row pinning', () => { }); // flaky in JSDOM - testSkipIf(isJSDOM)('should support cell editing', async () => { + it.skipIf(isJSDOM)('should support cell editing', async () => { const processRowUpdate = spy((row) => ({ ...row, currencyPair: 'USD-GBP' })); const columns: GridColDef[] = [{ field: 'id' }, { field: 'name', editable: true }]; const { user } = render( @@ -765,7 +764,7 @@ describe(' - Row pinning', () => { }); // flaky in JSDOM - testSkipIf(isJSDOM)('should support row editing', async () => { + it.skipIf(isJSDOM)('should support row editing', async () => { const processRowUpdate = spy((row) => ({ ...row, currencyPair: 'USD-GBP' })); const columns: GridColDef[] = [{ field: 'id' }, { field: 'name', editable: true }]; const { user } = render( diff --git a/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx index cbacad9ca224c..9a708545db52a 100644 --- a/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { createRenderer, fireEvent, screen, createEvent } from '@mui/internal-test-utils'; import { getCell, getColumnValues, getRowsFieldContent } from 'test/utils/helperFn'; diff --git a/packages/x-data-grid-pro/src/tests/rowSelection.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rowSelection.DataGridPro.test.tsx index e9a17aefc9179..8e0f3db84894c 100644 --- a/packages/x-data-grid-pro/src/tests/rowSelection.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rowSelection.DataGridPro.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { RefObject } from '@mui/x-internals/types'; import { getCell, getColumnValues, getRows, includeRowSelection } from 'test/utils/helperFn'; diff --git a/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx index 5e7ac3e1557a1..3cf9db802ae4f 100644 --- a/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { createRenderer, act, fireEvent, waitFor } from '@mui/internal-test-utils'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { vi } from 'vitest'; import { RefObject } from '@mui/x-internals/types'; import { @@ -26,7 +25,7 @@ import { GridValidRowModel, } from '@mui/x-data-grid-pro'; import { useBasicDemoData, getBasicGridData } from '@mui/x-data-grid-generator'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; interface BaselineProps extends DataGridProProps { rows: GridValidRowModel[]; @@ -430,7 +429,7 @@ describe(' - Rows', () => { }); // Need layouting - describeSkipIf(isJSDOM)('virtualization', () => { + describe.skipIf(isJSDOM)('virtualization', () => { let apiRef: RefObject; function TestCaseVirtualization( props: Partial & { diff --git a/packages/x-data-grid-pro/src/tests/sorting.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/sorting.DataGridPro.test.tsx index 5813775b74d2c..ec1cc31e78359 100644 --- a/packages/x-data-grid-pro/src/tests/sorting.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/sorting.DataGridPro.test.tsx @@ -9,10 +9,9 @@ import { GridColDef, } from '@mui/x-data-grid-pro'; import { createRenderer, fireEvent, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { getColumnValues, getCell, getColumnHeaderCell } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Sorting', () => { const baselineProps: DataGridProProps = { @@ -171,7 +170,7 @@ describe(' - Sorting', () => { }); // The number of renders depends on the user-agent - testSkipIf(!/HeadlessChrome/.test(window.navigator.userAgent) || !isJSDOM)( + it.skipIf(!/HeadlessChrome/.test(window.navigator.userAgent) || !isJSDOM)( 'should prune rendering on cells', () => { let renderCellCount: number = 0; diff --git a/packages/x-data-grid-pro/src/tests/state.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/state.DataGridPro.test.tsx index 871758e6bea3d..c55e62fa39f53 100644 --- a/packages/x-data-grid-pro/src/tests/state.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/state.DataGridPro.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { createRenderer, fireEvent, screen } from '@mui/internal-test-utils'; import { getColumnValues } from 'test/utils/helperFn'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { DataGridPro, useGridApiRef, GridApi, DataGridProProps } from '@mui/x-data-grid-pro'; diff --git a/packages/x-data-grid-pro/src/tests/statePersistence.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/statePersistence.DataGridPro.test.tsx index 05e6d0b7425d1..391164252b75f 100644 --- a/packages/x-data-grid-pro/src/tests/statePersistence.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/statePersistence.DataGridPro.test.tsx @@ -12,7 +12,6 @@ import { useGridApiRef, } from '@mui/x-data-grid-pro'; import { createRenderer, screen, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { getColumnHeaderCell, getColumnHeadersTextContent, diff --git a/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx index 447e42cc09fd9..2157dae9b0e0a 100644 --- a/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx @@ -9,7 +9,6 @@ import { } from 'test/utils/helperFn'; import { fireUserEvent } from 'test/utils/fireUserEvent'; import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { DataGridPro, diff --git a/packages/x-data-grid-pro/src/utils/tree/createRowTree.test.ts b/packages/x-data-grid-pro/src/utils/tree/createRowTree.test.ts index 81949a3538532..64822001a7503 100644 --- a/packages/x-data-grid-pro/src/utils/tree/createRowTree.test.ts +++ b/packages/x-data-grid-pro/src/utils/tree/createRowTree.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { GRID_ROOT_GROUP_ID, GridGroupNode, GridRowTreeConfig } from '@mui/x-data-grid'; import { createRowTree } from './createRowTree'; diff --git a/packages/x-data-grid-pro/tsconfig.json b/packages/x-data-grid-pro/tsconfig.json index 08e4c0e2576ce..58e8f08517683 100644 --- a/packages/x-data-grid-pro/tsconfig.json +++ b/packages/x-data-grid-pro/tsconfig.json @@ -4,11 +4,10 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-data-grid/src/hooks/features/columns/gridColumnsUtils.test.tsx b/packages/x-data-grid/src/hooks/features/columns/gridColumnsUtils.test.tsx index 530812e623532..daf2a031fd191 100644 --- a/packages/x-data-grid/src/hooks/features/columns/gridColumnsUtils.test.tsx +++ b/packages/x-data-grid/src/hooks/features/columns/gridColumnsUtils.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { computeFlexColumnsWidth } from './gridColumnsUtils'; describe('gridColumnsUtils', () => { diff --git a/packages/x-data-grid/src/hooks/utils/useGridEvent.test.tsx b/packages/x-data-grid/src/hooks/utils/useGridEvent.test.tsx index 8b608cbebca30..f6a970dd9f1bf 100644 --- a/packages/x-data-grid/src/hooks/utils/useGridEvent.test.tsx +++ b/packages/x-data-grid/src/hooks/utils/useGridEvent.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { createRenderer, reactMajor } from '@mui/internal-test-utils'; import { sleep } from 'test/utils/helperFn'; -import { isJSDOM, testSkipIf } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { useGridEvent, internal_registryContainer } from './useGridEvent'; import { FinalizationRegistryBasedCleanupTracking } from '../../utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking'; import { TimerBasedCleanupTracking } from '../../utils/cleanupTracking/TimerBasedCleanupTracking'; @@ -15,7 +14,7 @@ describe('useGridEvent', () => { describe('FinalizationRegistry-based implementation', () => { // Needs ability to trigger the garbage collector and support for FinalizationRegistry (added in node 14) - testSkipIf( + it.skipIf( !isJSDOM || typeof FinalizationRegistry === 'undefined' || typeof global.gc === 'undefined', )('should unsubscribe event listeners registered by uncommitted components', async () => { internal_registryContainer.current = new FinalizationRegistryBasedCleanupTracking(); diff --git a/packages/x-data-grid/src/tests/DataGrid.test.tsx b/packages/x-data-grid/src/tests/DataGrid.test.tsx index 30c207c9dea26..3b6b240a7598b 100644 --- a/packages/x-data-grid/src/tests/DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/DataGrid.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { createRenderer } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGrid, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid'; const isJSDOM = /jsdom/.test(window.navigator.userAgent); diff --git a/packages/x-data-grid/src/tests/accessibility.DataGrid.test.tsx b/packages/x-data-grid/src/tests/accessibility.DataGrid.test.tsx index 785336bfe4a37..8120fb4371993 100644 --- a/packages/x-data-grid/src/tests/accessibility.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/accessibility.DataGrid.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { createRenderer } from '@mui/internal-test-utils'; import { DataGrid } from '@mui/x-data-grid'; -import { expect } from 'chai'; describe(' - Accessibility', () => { const { render } = createRenderer(); diff --git a/packages/x-data-grid/src/tests/cells.DataGrid.test.tsx b/packages/x-data-grid/src/tests/cells.DataGrid.test.tsx index 7d817c3df7d08..f3a2d7960264d 100644 --- a/packages/x-data-grid/src/tests/cells.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/cells.DataGrid.test.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; import { spy } from 'sinon'; import { createRenderer, fireEvent, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGrid, GridValueFormatter } from '@mui/x-data-grid'; import { getCell } from 'test/utils/helperFn'; import { getBasicGridData } from '@mui/x-data-grid-generator'; -import { describeSkipIf, testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Cells', () => { const { render } = createRenderer(); @@ -52,7 +51,7 @@ describe(' - Cells', () => { }); // Doesn't work with mocked window.getComputedStyle - describeSkipIf(isJSDOM)('prop: showCellVerticalBorder', () => { + describe.skipIf(isJSDOM)('prop: showCellVerticalBorder', () => { function expectRightBorder(element: HTMLElement) { const computedStyle = window.getComputedStyle(element); const color = computedStyle.getPropertyValue('border-right-color'); @@ -175,7 +174,7 @@ describe(' - Cells', () => { }).toWarnDev(['MUI X: The cell with id=1 and field=brand received focus.']); }); - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should keep the focused cell/row rendered in the DOM if it scrolls outside the viewport', async () => { const rowHeight = 50; @@ -208,7 +207,7 @@ describe(' - Cells', () => { // See https://github.com/mui/mui-x/issues/6378 // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not cause scroll jump when focused cell mounts in the render zone', async () => { const rowHeight = 50; diff --git a/packages/x-data-grid/src/tests/columnGrouping.DataGrid.test.tsx b/packages/x-data-grid/src/tests/columnGrouping.DataGrid.test.tsx index 05f69a2dbd078..838eeb17b432f 100644 --- a/packages/x-data-grid/src/tests/columnGrouping.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/columnGrouping.DataGrid.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { expect } from 'chai'; import { createRenderer, ErrorBoundary, fireEvent, screen } from '@mui/internal-test-utils'; import { DataGrid, DataGridProps, GridRowModel, GridColDef } from '@mui/x-data-grid'; @@ -377,7 +376,6 @@ describe(' - Column grouping', () => { }); // TODO: remove the skip. I failed to test if an error is thrown - // eslint-disable-next-line mocha/no-skipped-tests describe.skip('error messages', () => { function TestWithError(props: TestDataGridProps) { return ( diff --git a/packages/x-data-grid/src/tests/columnHeaders.DataGrid.test.tsx b/packages/x-data-grid/src/tests/columnHeaders.DataGrid.test.tsx index 8b51e4c290146..f60181d6d0229 100644 --- a/packages/x-data-grid/src/tests/columnHeaders.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/columnHeaders.DataGrid.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { createRenderer, fireEvent, screen, waitFor, within } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGrid } from '@mui/x-data-grid'; import { getColumnHeaderCell, getColumnHeadersTextContent } from 'test/utils/helperFn'; diff --git a/packages/x-data-grid/src/tests/columnSpanning.DataGrid.test.tsx b/packages/x-data-grid/src/tests/columnSpanning.DataGrid.test.tsx index 987499b13eadb..02bc2599da5ea 100644 --- a/packages/x-data-grid/src/tests/columnSpanning.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/columnSpanning.DataGrid.test.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; import { act, createRenderer, screen, waitFor, within } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGrid, gridClasses, GridColDef } from '@mui/x-data-grid'; import { getCell, getActiveCell, getColumnHeaderCell } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Column spanning', () => { const { render } = createRenderer(); @@ -263,7 +262,7 @@ describe(' - Column spanning', () => { }); // needs virtualization - testSkipIf(isJSDOM)('should work with row virtualization', async () => { + it.skipIf(isJSDOM)('should work with row virtualization', async () => { const rows = [ { id: 0, @@ -319,7 +318,7 @@ describe(' - Column spanning', () => { }); // needs layout - testSkipIf(isJSDOM)('should work with column virtualization', async () => { + it.skipIf(isJSDOM)('should work with column virtualization', async () => { const { user } = render(
- Column spanning', () => { }); // needs layout - testSkipIf(isJSDOM)('should scroll the whole cell into view when `colSpan` > 1', async () => { + it.skipIf(isJSDOM)('should scroll the whole cell into view when `colSpan` > 1', async () => { const { user } = render(
- Column spanning', () => { }); // Need layout for column virtualization - testSkipIf(isJSDOM)('should work with column virtualization', async () => { + it.skipIf(isJSDOM)('should work with column virtualization', async () => { render(
- Column spanning', () => { }); // Need layout for column virtualization - testSkipIf(isJSDOM)('should work with both column and row virtualization', async () => { + it.skipIf(isJSDOM)('should work with both column and row virtualization', async () => { const rowHeight = 50; render( @@ -811,7 +810,7 @@ describe(' - Column spanning', () => { }); // Need layout for column virtualization - testSkipIf(isJSDOM)('should work with pagination and column virtualization', async () => { + it.skipIf(isJSDOM)('should work with pagination and column virtualization', async () => { const rowHeight = 50; function TestCase() { diff --git a/packages/x-data-grid/src/tests/columns.DataGrid.test.tsx b/packages/x-data-grid/src/tests/columns.DataGrid.test.tsx index bd2b30c2292ce..69f10f53ceb74 100644 --- a/packages/x-data-grid/src/tests/columns.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/columns.DataGrid.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { act, createRenderer, screen } from '@mui/internal-test-utils'; import { DataGrid, @@ -10,7 +9,7 @@ import { gridColumnLookupSelector, } from '@mui/x-data-grid'; import { getCell, getColumnHeaderCell, getColumnHeadersTextContent } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import type { RefObject } from '@mui/x-internals/types'; import type { GridApiCommunity } from '@mui/x-data-grid/internals'; @@ -132,7 +131,7 @@ describe(' - Columns', () => { // https://github.com/mui/mui-x/issues/13719 // Needs layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not crash when updating columns immediately after scrolling', async () => { const data = [ diff --git a/packages/x-data-grid/src/tests/columnsVisibility.DataGrid.test.tsx b/packages/x-data-grid/src/tests/columnsVisibility.DataGrid.test.tsx index f3902e6db89f9..28b71cf0b7bba 100644 --- a/packages/x-data-grid/src/tests/columnsVisibility.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/columnsVisibility.DataGrid.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { createRenderer, fireEvent, screen } from '@mui/internal-test-utils'; import { diff --git a/packages/x-data-grid/src/tests/dataSource.DataGrid.test.tsx b/packages/x-data-grid/src/tests/dataSource.DataGrid.test.tsx index d5c78834b5c9a..20c512ee7bf7c 100644 --- a/packages/x-data-grid/src/tests/dataSource.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/dataSource.DataGrid.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { useMockServer } from '@mui/x-data-grid-generator'; import { act, createRenderer, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { RefObject } from '@mui/x-internals/types'; import { DataGrid, @@ -13,7 +12,7 @@ import { useGridApiRef, } from '@mui/x-data-grid'; import { spy } from 'sinon'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { getCell } from 'test/utils/helperFn'; import { getKeyDefault } from '../hooks/features/dataSource/cache'; @@ -46,7 +45,7 @@ const serverOptions = { useCursorPagination: false, minDelay: 0, maxDelay: 0, ve const dataSetOptions = { rowLength: 100, maxColumns: 1, editable: true }; // Needs layout -describeSkipIf(isJSDOM)(' - Data source', () => { +describe.skipIf(isJSDOM)(' - Data source', () => { const { render } = createRenderer(); const fetchRowsSpy = spy(); const editRowSpy = spy(); diff --git a/packages/x-data-grid/src/tests/density.DataGrid.test.tsx b/packages/x-data-grid/src/tests/density.DataGrid.test.tsx index 41e5bc8259e45..40eda19850251 100644 --- a/packages/x-data-grid/src/tests/density.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/density.DataGrid.test.tsx @@ -2,16 +2,15 @@ import * as React from 'react'; import { spy } from 'sinon'; import { createRenderer, fireEvent, screen } from '@mui/internal-test-utils'; import { grid } from 'test/utils/helperFn'; -import { expect } from 'chai'; import { DataGrid, DataGridProps, gridClasses, GridToolbar } from '@mui/x-data-grid'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { COMFORTABLE_DENSITY_FACTOR, COMPACT_DENSITY_FACTOR, } from '../hooks/features/density/densitySelector'; // JSDOM seem to not support CSS variables properly and `height: var(--height)` ends up being `height: ''` -describeSkipIf(isJSDOM)(' - Density', () => { +describe.skipIf(isJSDOM)(' - Density', () => { const { render } = createRenderer(); const baselineProps = { diff --git a/packages/x-data-grid/src/tests/export.DataGrid.test.tsx b/packages/x-data-grid/src/tests/export.DataGrid.test.tsx index a5a0a64910349..8461d40790fab 100644 --- a/packages/x-data-grid/src/tests/export.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/export.DataGrid.test.tsx @@ -1,13 +1,12 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy, SinonSpy } from 'sinon'; import { DataGrid, DataGridProps, GridToolbarExport } from '@mui/x-data-grid'; import { useBasicDemoData } from '@mui/x-data-grid-generator'; import { createRenderer, screen, fireEvent } from '@mui/internal-test-utils'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; // We need `createObjectURL` to test the downloaded value -describeSkipIf(isJSDOM)(' - Export', () => { +describe.skipIf(isJSDOM)(' - Export', () => { const { render } = createRenderer(); function TestCase(props: Omit) { @@ -22,12 +21,10 @@ describeSkipIf(isJSDOM)(' - Export', () => { let spyCreateObjectURL: SinonSpy; - // eslint-disable-next-line mocha/no-top-level-hooks beforeEach(() => { spyCreateObjectURL = spy(globalThis.URL, 'createObjectURL'); }); - // eslint-disable-next-line mocha/no-top-level-hooks afterEach(() => { spyCreateObjectURL.restore(); }); diff --git a/packages/x-data-grid/src/tests/filterPanel.DataGrid.test.tsx b/packages/x-data-grid/src/tests/filterPanel.DataGrid.test.tsx index e58dda2790a52..882add36522dc 100644 --- a/packages/x-data-grid/src/tests/filterPanel.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/filterPanel.DataGrid.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { DataGrid, diff --git a/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx b/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx index 1f418a76a8557..6931dba6a7dfd 100644 --- a/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { createRenderer, fireEvent, screen, waitFor } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGrid, DataGridProps, diff --git a/packages/x-data-grid/src/tests/keyboard.DataGrid.test.tsx b/packages/x-data-grid/src/tests/keyboard.DataGrid.test.tsx index 45658359fe5f8..c8a5ca2f25eb6 100644 --- a/packages/x-data-grid/src/tests/keyboard.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/keyboard.DataGrid.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { createRenderer, fireEvent, screen, act } from '@mui/internal-test-utils'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { getActiveCell, getActiveColumnHeader, @@ -20,7 +19,7 @@ import { } from '@mui/x-data-grid'; import { useBasicDemoData, getBasicGridData } from '@mui/x-data-grid-generator'; import RestoreIcon from '@mui/icons-material/Restore'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; const PAGE_SIZE = 10; const ROW_HEIGHT = 52; @@ -162,7 +161,7 @@ describe(' - Keyboard', () => { }); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move down by the amount of rows visible on screen when pressing "PageDown"', async () => { const { user } = render(); @@ -177,7 +176,7 @@ describe(' - Keyboard', () => { ); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move down by the amount of rows visible on screen when pressing Space key', async () => { const { user } = render(); @@ -192,7 +191,7 @@ describe(' - Keyboard', () => { ); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move up by the amount of rows visible on screen when pressing "PageUp"', async () => { const { user } = render(); @@ -205,7 +204,7 @@ describe(' - Keyboard', () => { ); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move to the first row before moving to column header when pressing "PageUp"', async () => { const { user } = render(); @@ -223,7 +222,7 @@ describe(' - Keyboard', () => { ); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move to the first row before moving to column header when pressing "PageUp" on page > 0', async () => { const { user } = render(); @@ -314,7 +313,7 @@ describe(' - Keyboard', () => { describe('column header navigation', () => { // Need layout for column virtualization - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should scroll horizontally when navigating between column headers with arrows', async () => { const { user } = render( @@ -333,7 +332,7 @@ describe(' - Keyboard', () => { ); // Need layout for column virtualization - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should scroll horizontally when navigating between column headers with arrows even if rows are empty', async () => { const { user } = render( @@ -388,7 +387,7 @@ describe(' - Keyboard', () => { }); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move down by the amount of rows visible on screen when pressing "PageDown"', async () => { const { user } = render(); @@ -400,7 +399,7 @@ describe(' - Keyboard', () => { ); // This test is not relevant if we can't choose the actual height - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should move focus when the focus is on a column header button', async () => { const { user } = render(); @@ -506,7 +505,7 @@ describe(' - Keyboard', () => { } // Need layouting for column virtualization - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should scroll horizontally when navigating between column group headers with arrows', async () => { const { user } = render( @@ -527,7 +526,7 @@ describe(' - Keyboard', () => { ); // Need layouting for column virtualization - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should scroll horizontally when navigating between column headers with arrows even if rows are empty', async () => { const { user } = render( diff --git a/packages/x-data-grid/src/tests/layout.DataGrid.test.tsx b/packages/x-data-grid/src/tests/layout.DataGrid.test.tsx index ed148d9e434e4..fe9377e524a51 100644 --- a/packages/x-data-grid/src/tests/layout.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/layout.DataGrid.test.tsx @@ -9,7 +9,6 @@ import { act, } from '@mui/internal-test-utils'; import { stub, spy } from 'sinon'; -import { expect } from 'chai'; import { DataGrid, DataGridProps, @@ -31,7 +30,7 @@ import { getRow, sleep, } from 'test/utils/helperFn'; -import { describeSkipIf, testSkipIf, isJSDOM, isOSX } from 'test/utils/skipIf'; +import { isJSDOM, isOSX } from 'test/utils/skipIf'; const getVariable = (name: string) => $('.MuiDataGrid-root')!.style.getPropertyValue(name); @@ -82,7 +81,7 @@ describe(' - Layout & warnings', () => { }); // Need layout to be able to measure the columns - describeSkipIf(isJSDOM)('Layout', () => { + describe.skipIf(isJSDOM)('Layout', () => { it('should resize the width of the columns', async () => { interface TestCaseProps { width?: number; @@ -690,7 +689,7 @@ describe(' - Layout & warnings', () => { }); // On MacOS the scrollbar has zero width - testSkipIf(isOSX)( + it.skipIf(isOSX)( 'should include the scrollbar in the intrinsic height when there are more columns to show', () => { const columnHeaderHeight = 40; @@ -786,7 +785,7 @@ describe(' - Layout & warnings', () => { }); // On MacOS the scrollbar has zero width - testSkipIf(isOSX)( + it.skipIf(isOSX)( 'should have a horizontal scrollbar when there are more columns to show and no rows', () => { render( @@ -921,7 +920,6 @@ describe(' - Layout & warnings', () => { describe('warnings', () => { // TODO: reintroduce chainProptypes that has been removed in https://github.com/mui/mui-x/pull/11303 - // eslint-disable-next-line mocha/no-skipped-tests it.skip('should raise a warning if trying to use an enterprise feature', () => { expect(() => { render( @@ -935,7 +933,7 @@ describe(' - Layout & warnings', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw if the rows has no id', () => { + it.skipIf(!isJSDOM)('should throw if the rows has no id', () => { const rows = [ { brand: 'Nike', @@ -994,7 +992,7 @@ describe(' - Layout & warnings', () => { describe('non-strict mode', () => { const { render: innerRender } = createRenderer({ strict: false }); - testSkipIf(!isJSDOM)('should render in JSDOM', () => { + it.skipIf(!isJSDOM)('should render in JSDOM', () => { innerRender(
@@ -1006,7 +1004,7 @@ describe(' - Layout & warnings', () => { }); // Doesn't work with mocked window.getComputedStyle - testSkipIf(isJSDOM)('should allow style customization using the theme', () => { + it.skipIf(isJSDOM)('should allow style customization using the theme', () => { const theme = createTheme({ components: { MuiDataGrid: { @@ -1045,7 +1043,7 @@ describe(' - Layout & warnings', () => { }); // Doesn't work with mocked window.getComputedStyle - testSkipIf(isJSDOM)('should support the sx prop', () => { + it.skipIf(isJSDOM)('should support the sx prop', () => { const theme = createTheme({ palette: { primary: { @@ -1124,7 +1122,7 @@ describe(' - Layout & warnings', () => { }); // Doesn't work with mocked window.getComputedStyle - describeSkipIf(isJSDOM)('should not overflow parent', () => { + describe.skipIf(isJSDOM)('should not overflow parent', () => { const rows = [{ id: 1, username: '@MUI', age: 20 }]; const columns = [ { field: 'id', width: 300 }, @@ -1158,7 +1156,7 @@ describe(' - Layout & warnings', () => { // See https://github.com/mui/mui-x/issues/8737 // Need layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not add horizontal scrollbar when .MuiDataGrid-main has border', async () => { render( @@ -1187,7 +1185,7 @@ describe(' - Layout & warnings', () => { // See https://github.com/mui/mui-x/issues/8689#issuecomment-1582616570 // Need layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not add scrollbars when the parent container has fractional size', async () => { render( @@ -1205,7 +1203,7 @@ describe(' - Layout & warnings', () => { // See https://github.com/mui/mui-x/issues/9510 // Need layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not exceed maximum call stack size when the parent container has fractional width', () => { render( @@ -1218,7 +1216,7 @@ describe(' - Layout & warnings', () => { // See https://github.com/mui/mui-x/issues/9550 // Need layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not exceed maximum call stack size with duplicated flex fields', () => { expect(() => { @@ -1242,7 +1240,7 @@ describe(' - Layout & warnings', () => { // See https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477 // Need layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not exceed maximum call stack size caused by floating point precision error', () => { render( @@ -1265,7 +1263,7 @@ describe(' - Layout & warnings', () => { // See https://github.com/mui/mui-x/issues/15721 // Need layout - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not exceed maximum call stack size caused by subpixel rendering', () => { render( diff --git a/packages/x-data-grid/src/tests/pagination.DataGrid.test.tsx b/packages/x-data-grid/src/tests/pagination.DataGrid.test.tsx index 3ee3f8445659b..79ba4e9ffde3b 100644 --- a/packages/x-data-grid/src/tests/pagination.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/pagination.DataGrid.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { spy, SinonSpy } from 'sinon'; -import { expect } from 'chai'; import { createRenderer, fireEvent, @@ -22,7 +21,7 @@ import { import { useBasicDemoData } from '@mui/x-data-grid-generator'; import { getCell, getColumnValues, getRows } from 'test/utils/helperFn'; import { fireUserEvent } from 'test/utils/fireUserEvent'; -import { isJSDOM, describeSkipIf } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Pagination', () => { const { render } = createRenderer(); @@ -42,7 +41,7 @@ describe(' - Pagination', () => { } // Need layouting - describeSkipIf(isJSDOM)('prop: paginationModel and onPaginationModelChange', () => { + describe.skipIf(isJSDOM)('prop: paginationModel and onPaginationModelChange', () => { it('should display the rows of page given in props', () => { render(); expect(getColumnValues(0)).to.deep.equal(['1']); @@ -390,7 +389,7 @@ describe(' - Pagination', () => { }); // Need layout - describeSkipIf(isJSDOM)('prop: autoPageSize', () => { + describe.skipIf(isJSDOM)('prop: autoPageSize', () => { function TestCaseAutoPageSize( props: Omit & { height: number; nbRows: number }, ) { @@ -682,7 +681,7 @@ describe(' - Pagination', () => { }); // Need layout - describeSkipIf(isJSDOM)('prop: initialState.pagination', () => { + describe.skipIf(isJSDOM)('prop: initialState.pagination', () => { it('should allow to initialize the paginationModel', () => { render( - Row selection', () => { }); // HTMLElement.focus() only scrolls to the element on a real browser - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should not jump during scroll while the focus is on the checkbox', async () => { const data = getBasicGridData(20, 1); @@ -638,7 +637,7 @@ describe(' - Row selection', () => { // // // JSDOM doesn't fire "blur" when .focus is called in another element // // FIXME Firefox doesn't show any ripple - // testSkipIf(isJSDOM)('should keep only one ripple visible when navigating between checkboxes', async () => { + // it.skipIf(isJSDOM)('should keep only one ripple visible when navigating between checkboxes', async () => { // render(); // const cell = getCell(1, 1); // fireUserEvent.mousePress(cell); diff --git a/packages/x-data-grid/src/tests/rowSpanning.DataGrid.test.tsx b/packages/x-data-grid/src/tests/rowSpanning.DataGrid.test.tsx index 227d62827ffe3..fbe3661c5c13f 100644 --- a/packages/x-data-grid/src/tests/rowSpanning.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/rowSpanning.DataGrid.test.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { createRenderer, fireEvent, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { DataGrid, useGridApiRef, DataGridProps, GridApi } from '@mui/x-data-grid'; import { getCell, getActiveCell } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Row spanning', () => { const { render } = createRenderer(); @@ -113,7 +112,7 @@ describe(' - Row spanning', () => { const rowHeight = 52; - testSkipIf(isJSDOM)('should span the repeating row values', () => { + it.skipIf(isJSDOM)('should span the repeating row values', () => { render(); if (!apiRef.current?.state) { @@ -131,7 +130,7 @@ describe(' - Row spanning', () => { }); describe('sorting', () => { - testSkipIf(isJSDOM)('should work with sorting when initializing sorting', () => { + it.skipIf(isJSDOM)('should work with sorting when initializing sorting', () => { render( - Row spanning', () => { expect(spannedCell).to.have.style('height', `${rowHeight * spanValue.code}px`); }); - testSkipIf(isJSDOM)('should work with sorting when controlling sorting', () => { + it.skipIf(isJSDOM)('should work with sorting when controlling sorting', () => { render(); if (!apiRef.current?.state) { @@ -171,7 +170,7 @@ describe(' - Row spanning', () => { }); describe('filtering', () => { - testSkipIf(isJSDOM)('should work with filtering when initializing filter', () => { + it.skipIf(isJSDOM)('should work with filtering when initializing filter', () => { render( - Row spanning', () => { expect(spannedCell).to.have.style('height', `${rowHeight * spanValue.code}px`); }); - testSkipIf(isJSDOM)('should work with filtering when controlling filter', () => { + it.skipIf(isJSDOM)('should work with filtering when controlling filter', () => { render( - Row spanning', () => { }); describe('pagination', () => { - testSkipIf(isJSDOM)('should only compute the row spanning state for current page', async () => { + it.skipIf(isJSDOM)('should only compute the row spanning state for current page', async () => { render( - Rows', () => { ); } - testSkipIf(!isJSDOM)('should throw an error if getActions is missing', () => { + it.skipIf(!isJSDOM)('should throw an error if getActions is missing', () => { expect(() => { render( @@ -482,7 +481,7 @@ describe(' - Rows', () => { }); // Need layouting - describeSkipIf(isJSDOM)('prop: getRowHeight', () => { + describe.skipIf(isJSDOM)('prop: getRowHeight', () => { describe('static row height', () => { const ROW_HEIGHT = 52; function TestCase(props: Partial) { @@ -804,7 +803,7 @@ describe(' - Rows', () => { }); const { userAgent } = window.navigator; - testSkipIf(!userAgent.includes('Headless') || /edg/i.test(userAgent))( + it.skipIf(!userAgent.includes('Headless') || /edg/i.test(userAgent))( 'should position correctly the render zone when the 2nd page has less rows than the 1st page', async () => { const data = getBasicGridData(120, 3); @@ -862,13 +861,12 @@ describe(' - Rows', () => { }); // In Chrome non-headless and Edge this test is flaky - testSkipIf(!isJSDOM || !userAgent.includes('Headless') || /edg/i.test(userAgent))( + it.skipIf(!isJSDOM || !userAgent.includes('Headless') || /edg/i.test(userAgent))( 'should position correctly the render zone when changing pageSize to a lower value and moving to next page', { // Retry the test because it is flaky - retries: 3, + retry: 3, }, - // @ts-expect-error mocha types are incorrect async () => { const data = getBasicGridData(120, 3); const columnHeaderHeight = 50; @@ -969,7 +967,7 @@ describe(' - Rows', () => { }); // Needs layout - testSkipIf(isJSDOM)('should consider the spacing when computing the content size', () => { + it.skipIf(isJSDOM)('should consider the spacing when computing the content size', () => { const spacingTop = 5; const spacingBottom = 10; const rowHeight = 50; @@ -987,7 +985,7 @@ describe(' - Rows', () => { }); // Needs layout - testSkipIf(isJSDOM)('should update the content size when getRowSpacing is removed', () => { + it.skipIf(isJSDOM)('should update the content size when getRowSpacing is removed', () => { const spacingTop = 5; const spacingBottom = 10; const rowHeight = 50; @@ -1119,7 +1117,7 @@ describe(' - Rows', () => { // https://github.com/mui/mui-x/issues/10373 // needs virtualization - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should set proper `data-rowindex` and `aria-rowindex` when focused row is out of the viewport', async () => { const { user } = render( diff --git a/packages/x-data-grid/src/tests/slots.DataGrid.test.tsx b/packages/x-data-grid/src/tests/slots.DataGrid.test.tsx index c44573bca9149..3bbf79e823fc5 100644 --- a/packages/x-data-grid/src/tests/slots.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/slots.DataGrid.test.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; import { createRenderer, ErrorBoundary, reactMajor, screen } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { DataGrid, DataGridProps, GridOverlay } from '@mui/x-data-grid'; import { getCell, getRow } from 'test/utils/helperFn'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describe(' - Slots', () => { const { render } = createRenderer(); @@ -156,7 +155,7 @@ describe(' - Slots', () => { // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw if a component is used without providing the context', () => { + it.skipIf(!isJSDOM)('should throw if a component is used without providing the context', () => { expect(() => { render( diff --git a/packages/x-data-grid/src/tests/sorting.DataGrid.test.tsx b/packages/x-data-grid/src/tests/sorting.DataGrid.test.tsx index 244d305024a6a..f93283d964fc9 100644 --- a/packages/x-data-grid/src/tests/sorting.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/sorting.DataGrid.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { RefObject } from '@mui/x-internals/types'; import { createRenderer, fireEvent, screen, act } from '@mui/internal-test-utils'; -import { expect } from 'chai'; import { DataGrid, DataGridProps, diff --git a/packages/x-data-grid/src/tests/toolbar.DataGrid.test.tsx b/packages/x-data-grid/src/tests/toolbar.DataGrid.test.tsx index abf0271444b62..3a024d54b525e 100644 --- a/packages/x-data-grid/src/tests/toolbar.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/toolbar.DataGrid.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { createRenderer, screen, act } from '@mui/internal-test-utils'; import { getColumnHeadersTextContent } from 'test/utils/helperFn'; -import { expect } from 'chai'; import { DataGrid, GridColumnsManagementProps, Toolbar, ToolbarButton } from '@mui/x-data-grid'; import { isJSDOM } from 'test/utils/skipIf'; diff --git a/packages/x-data-grid/src/utils/createSelector.test.ts b/packages/x-data-grid/src/utils/createSelector.test.ts index 43681179c49da..f0b173c4528f9 100644 --- a/packages/x-data-grid/src/utils/createSelector.test.ts +++ b/packages/x-data-grid/src/utils/createSelector.test.ts @@ -1,5 +1,4 @@ import { RefObject } from '@mui/x-internals/types'; -import { expect } from 'chai'; import { createSelectorMemoized, OutputSelector } from './createSelector'; import { GridStateCommunity } from '../models/gridStateCommunity'; import { GridApiCommunity } from '../models/api/gridApiCommunity'; diff --git a/packages/x-data-grid/tsconfig.json b/packages/x-data-grid/tsconfig.json index a95beb1e8020a..58e8f08517683 100644 --- a/packages/x-data-grid/tsconfig.json +++ b/packages/x-data-grid/tsconfig.json @@ -4,10 +4,10 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" - ] + ], + "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx b/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx index e3c5e28d5bade..0c3988dbdc3eb 100644 --- a/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx +++ b/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { screen, fireEvent, @@ -21,7 +20,6 @@ import { } from '@mui/x-date-pickers-pro/DateRangeCalendar'; import { DateRangePickerDay } from '@mui/x-date-pickers-pro/DateRangePickerDay'; import { describeConformance } from 'test/utils/describeConformance'; -import { testSkipIf } from 'test/utils/skipIf'; import { RangePosition } from '../models'; const getPickerDay = (name: string, picker = 'January 2018') => @@ -183,7 +181,7 @@ describe('', () => { expect(onChange.callCount).to.equal(0); }); - testSkipIf(!document.elementFromPoint)( + it.skipIf(!document.elementFromPoint)( 'should not emit "onChange" when touch dragging is ended where it was started', () => { const onChange = spy(); @@ -251,7 +249,7 @@ describe('', () => { expect(document.activeElement).toHaveAccessibleName('2'); }); - testSkipIf(!document.elementFromPoint)( + it.skipIf(!document.elementFromPoint)( 'should emit "onChange" when touch dragging end date', () => { const onChange = spy(); @@ -329,7 +327,7 @@ describe('', () => { expect(document.activeElement).toHaveAccessibleName('22'); }); - testSkipIf(!document.elementFromPoint)( + it.skipIf(!document.elementFromPoint)( 'should emit "onChange" when touch dragging start date', () => { const onChange = spy(); @@ -404,7 +402,7 @@ describe('', () => { ).to.have.lengthOf(10); }); - testSkipIf(!document.elementFromPoint)( + it.skipIf(!document.elementFromPoint)( 'should dynamically update "shouldDisableDate" when flip touch dragging', () => { const initialValue: [any, any] = [ diff --git a/packages/x-date-pickers-pro/src/DateRangeCalendar/timezone.DateRangeCalendar.test.tsx b/packages/x-date-pickers-pro/src/DateRangeCalendar/timezone.DateRangeCalendar.test.tsx index 42b16fe1c9ddc..31e82e9ed4200 100644 --- a/packages/x-date-pickers-pro/src/DateRangeCalendar/timezone.DateRangeCalendar.test.tsx +++ b/packages/x-date-pickers-pro/src/DateRangeCalendar/timezone.DateRangeCalendar.test.tsx @@ -1,13 +1,11 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen, fireEvent } from '@mui/internal-test-utils'; import { describeAdapters } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; import { DateRangeCalendar } from './DateRangeCalendar'; describe(' - Timezone', () => { describeAdapters('Timezone prop', DateRangeCalendar, ({ adapter, render }) => { - describeSkipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { + describe.skipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { it('should correctly render month days when timezone changes', () => { function DateCalendarWithControlledTimezone() { const [timezone, setTimezone] = React.useState('Europe/Paris'); diff --git a/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePicker.test.tsx b/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePicker.test.tsx index 10b2048c56286..2e12976d52f81 100644 --- a/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePicker.test.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { DateRangePicker, DateRangePickerProps } from '@mui/x-date-pickers-pro/DateRangePicker'; import { screen } from '@mui/internal-test-utils/createRenderer'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { buildFieldInteractions, diff --git a/packages/x-date-pickers-pro/src/DesktopDateRangePicker/tests/DesktopDateRangePicker.test.tsx b/packages/x-date-pickers-pro/src/DesktopDateRangePicker/tests/DesktopDateRangePicker.test.tsx index b3032d3acc2fc..2f7616cc79634 100644 --- a/packages/x-date-pickers-pro/src/DesktopDateRangePicker/tests/DesktopDateRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/DesktopDateRangePicker/tests/DesktopDateRangePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, screen, act, within, waitFor } from '@mui/internal-test-utils'; import { createTheme, ThemeProvider } from '@mui/material/styles'; @@ -16,7 +15,7 @@ import { getFieldSectionsContainer, getTextbox, } from 'test/utils/pickers'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { vi } from 'vitest'; const getPickerDay = (name: string, picker = 'January 2018') => @@ -482,7 +481,7 @@ describe('', () => { }); // test:unit does not call `blur` when focusing another element. - testSkipIf(isJSDOM)( + it.skipIf(isJSDOM)( 'should call onClose when blur the current field without prior change (multi input field)', async () => { const onChange = spy(); diff --git a/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/tests/DesktopDateTimeRangePicker.test.tsx b/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/tests/DesktopDateTimeRangePicker.test.tsx index 56eb20140dfe3..52b7ff8e3ca04 100644 --- a/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/tests/DesktopDateTimeRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/tests/DesktopDateTimeRangePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { createPickerRenderer, diff --git a/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx b/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx index bb7668093f788..ef4773cf6ca07 100644 --- a/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { screen, fireEvent } from '@mui/internal-test-utils'; import { MobileDateRangePicker } from '@mui/x-date-pickers-pro/MobileDateRangePicker'; import { diff --git a/packages/x-date-pickers-pro/src/MobileDateTimeRangePicker/tests/MobileDateTimeRangePicker.test.tsx b/packages/x-date-pickers-pro/src/MobileDateTimeRangePicker/tests/MobileDateTimeRangePicker.test.tsx index d04d45af40a20..48863f248709c 100644 --- a/packages/x-date-pickers-pro/src/MobileDateTimeRangePicker/tests/MobileDateTimeRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/MobileDateTimeRangePicker/tests/MobileDateTimeRangePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { createPickerRenderer, diff --git a/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/editing.SingleInputDateRangeField.test.tsx b/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/editing.SingleInputDateRangeField.test.tsx index e09ead9e925b6..d4e54f49401f6 100644 --- a/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/editing.SingleInputDateRangeField.test.tsx +++ b/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/editing.SingleInputDateRangeField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { spy } from 'sinon'; import { SingleInputDateRangeField } from '@mui/x-date-pickers-pro/SingleInputDateRangeField'; import { fireEvent, waitFor } from '@mui/internal-test-utils'; diff --git a/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/selection.SingleInputDateRangeField.test.tsx b/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/selection.SingleInputDateRangeField.test.tsx index c71d13dff5520..e8156f18eed6d 100644 --- a/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/selection.SingleInputDateRangeField.test.tsx +++ b/packages/x-date-pickers-pro/src/SingleInputDateRangeField/tests/selection.SingleInputDateRangeField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { SingleInputDateRangeField } from '@mui/x-date-pickers-pro/SingleInputDateRangeField'; import { act, fireEvent } from '@mui/internal-test-utils'; import { diff --git a/packages/x-date-pickers-pro/src/StaticDateRangePicker/StaticDateRangePicker.test.tsx b/packages/x-date-pickers-pro/src/StaticDateRangePicker/StaticDateRangePicker.test.tsx index 5518ca8e25dba..148e9329c5a86 100644 --- a/packages/x-date-pickers-pro/src/StaticDateRangePicker/StaticDateRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/StaticDateRangePicker/StaticDateRangePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { isWeekend } from 'date-fns'; import { StaticDateRangePicker } from '@mui/x-date-pickers-pro/StaticDateRangePicker'; import { screen } from '@mui/internal-test-utils'; diff --git a/packages/x-date-pickers-pro/src/internals/utils/date-range-manager.test.ts b/packages/x-date-pickers-pro/src/internals/utils/date-range-manager.test.ts index 546704091800e..7822bdc36498d 100644 --- a/packages/x-date-pickers-pro/src/internals/utils/date-range-manager.test.ts +++ b/packages/x-date-pickers-pro/src/internals/utils/date-range-manager.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { adapterToUse } from 'test/utils/pickers'; import { PickerValidDate } from '@mui/x-date-pickers/models'; import { calculateRangeChange, calculateRangePreview } from './date-range-manager'; diff --git a/packages/x-date-pickers-pro/tsconfig.json b/packages/x-date-pickers-pro/tsconfig.json index 048fc82f52d59..a5dcaaadd3f77 100644 --- a/packages/x-date-pickers-pro/tsconfig.json +++ b/packages/x-date-pickers-pro/tsconfig.json @@ -4,10 +4,9 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", "dayjs/plugin/timezone.d.ts", "dayjs/plugin/utc.d.ts", - "mocha", + "vitest/globals", "node" ], "noImplicitAny": false, diff --git a/packages/x-date-pickers/src/AdapterDateFns/AdapterDateFns.test.tsx b/packages/x-date-pickers/src/AdapterDateFns/AdapterDateFns.test.tsx index 564ba4608bc19..c4a045f3921a9 100644 --- a/packages/x-date-pickers/src/AdapterDateFns/AdapterDateFns.test.tsx +++ b/packages/x-date-pickers/src/AdapterDateFns/AdapterDateFns.test.tsx @@ -1,7 +1,6 @@ import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; import { AdapterFormats } from '@mui/x-date-pickers/models'; -import { expect } from 'chai'; import { createPickerRenderer, expectFieldValueV7, diff --git a/packages/x-date-pickers/src/AdapterDateFnsJalali/AdapterDateFnsJalali.test.tsx b/packages/x-date-pickers/src/AdapterDateFnsJalali/AdapterDateFnsJalali.test.tsx index cabba707e2212..bac27e5154df6 100644 --- a/packages/x-date-pickers/src/AdapterDateFnsJalali/AdapterDateFnsJalali.test.tsx +++ b/packages/x-date-pickers/src/AdapterDateFnsJalali/AdapterDateFnsJalali.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalali'; import { diff --git a/packages/x-date-pickers/src/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.test.tsx b/packages/x-date-pickers/src/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.test.tsx index f58ad65a60e57..ed7a63ad6189f 100644 --- a/packages/x-date-pickers/src/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.test.tsx +++ b/packages/x-date-pickers/src/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV2'; import { diff --git a/packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.test.tsx b/packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.test.tsx index c0a57036bd069..3a5ff88c6fb22 100644 --- a/packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.test.tsx +++ b/packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.test.tsx @@ -2,7 +2,6 @@ import dayjs, { Dayjs } from 'dayjs'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { AdapterFormats, PickerValidDate } from '@mui/x-date-pickers/models'; -import { expect } from 'chai'; import { expectFieldValueV7, createPickerRenderer, diff --git a/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.test.tsx b/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.test.tsx index 74d039083fbcc..0fccd56a88310 100644 --- a/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.test.tsx +++ b/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DateTime, Settings } from 'luxon'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon'; diff --git a/packages/x-date-pickers/src/AdapterMoment/AdapterMoment.test.tsx b/packages/x-date-pickers/src/AdapterMoment/AdapterMoment.test.tsx index d8e25d023e991..a85cb40b90d64 100644 --- a/packages/x-date-pickers/src/AdapterMoment/AdapterMoment.test.tsx +++ b/packages/x-date-pickers/src/AdapterMoment/AdapterMoment.test.tsx @@ -3,7 +3,6 @@ import momentTZ from 'moment-timezone'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'; import { AdapterFormats, PickerValidDate } from '@mui/x-date-pickers/models'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { createPickerRenderer, diff --git a/packages/x-date-pickers/src/AdapterMomentHijri/AdapterMomentHijri.test.tsx b/packages/x-date-pickers/src/AdapterMomentHijri/AdapterMomentHijri.test.tsx index 023bc85553ecf..271d57e51e380 100644 --- a/packages/x-date-pickers/src/AdapterMomentHijri/AdapterMomentHijri.test.tsx +++ b/packages/x-date-pickers/src/AdapterMomentHijri/AdapterMomentHijri.test.tsx @@ -1,5 +1,4 @@ import moment, { Moment } from 'moment-hijri'; -import { expect } from 'chai'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; import { AdapterMomentHijri } from '@mui/x-date-pickers/AdapterMomentHijri'; import { AdapterFormats } from '@mui/x-date-pickers/models'; diff --git a/packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.test.tsx b/packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.test.tsx index 0093b987c10f0..36c9c584f32e3 100644 --- a/packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.test.tsx +++ b/packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import moment from 'moment'; import jMoment, { Moment } from 'moment-jalaali'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; @@ -23,11 +22,11 @@ describe('', () => { }); describe('Adapter localization', () => { - before(() => { + beforeAll(() => { jMoment.loadPersian({ dialect: 'persian-modern', usePersianDigits: true }); }); - after(() => { + afterAll(() => { moment.locale('en'); }); @@ -48,11 +47,11 @@ describe('', () => { }); describe('Picker localization', () => { - before(() => { + beforeAll(() => { jMoment.loadPersian(); }); - after(() => { + afterAll(() => { moment.locale('en'); }); diff --git a/packages/x-date-pickers/src/DateCalendar/tests/DateCalendar.test.tsx b/packages/x-date-pickers/src/DateCalendar/tests/DateCalendar.test.tsx index 37748157320cd..7f29b2c6d1d2b 100644 --- a/packages/x-date-pickers/src/DateCalendar/tests/DateCalendar.test.tsx +++ b/packages/x-date-pickers/src/DateCalendar/tests/DateCalendar.test.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; -import { expect } from 'chai'; import { fireEvent, screen, waitFor } from '@mui/internal-test-utils'; import { DateCalendar } from '@mui/x-date-pickers/DateCalendar'; import { PickersDay } from '@mui/x-date-pickers/PickersDay'; import { createPickerRenderer, adapterToUse } from 'test/utils/pickers'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { spy } from 'sinon'; import { vi } from 'vitest'; @@ -530,7 +529,7 @@ describe('', () => { }); // Needs layout - testSkipIf(isJSDOM)('should scroll to show the selected year', () => { + it.skipIf(isJSDOM)('should scroll to show the selected year', () => { render( - Timezone', () => { describeAdapters('Timezone prop', DateCalendar, ({ adapter, render }) => { - describeSkipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { + describe.skipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { it('should use default timezone for rendering and onChange when no value and no timezone prop are provided', () => { const onChange = spy(); render(); diff --git a/packages/x-date-pickers/src/DateCalendar/tests/validation.DateCalendar.test.tsx b/packages/x-date-pickers/src/DateCalendar/tests/validation.DateCalendar.test.tsx index 55a0c896b5e2a..2fbc944e945d5 100644 --- a/packages/x-date-pickers/src/DateCalendar/tests/validation.DateCalendar.test.tsx +++ b/packages/x-date-pickers/src/DateCalendar/tests/validation.DateCalendar.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen, waitFor } from '@mui/internal-test-utils'; import { DateCalendar, DateCalendarProps } from '@mui/x-date-pickers/DateCalendar'; import { PickerValidDate } from '@mui/x-date-pickers/models'; diff --git a/packages/x-date-pickers/src/DateField/tests/editing.DateField.test.tsx b/packages/x-date-pickers/src/DateField/tests/editing.DateField.test.tsx index 0669db5de36f6..d0c685bc590d7 100644 --- a/packages/x-date-pickers/src/DateField/tests/editing.DateField.test.tsx +++ b/packages/x-date-pickers/src/DateField/tests/editing.DateField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { spy } from 'sinon'; import { DateField } from '@mui/x-date-pickers/DateField'; import { act, fireEvent, waitFor } from '@mui/internal-test-utils'; @@ -10,7 +9,6 @@ import { getCleanedSelectedContent, } from 'test/utils/pickers'; import { fireUserEvent } from 'test/utils/fireUserEvent'; -import { testSkipIf } from 'test/utils/skipIf'; describe(' - Editing', () => { describeAdapters( @@ -320,7 +318,7 @@ describe(' - Editing', () => { }); // Luxon doesn't have any day format with a letter suffix - testSkipIf(adapter.lib === 'luxon')('should support day with letter suffix', () => { + it.skipIf(adapter.lib === 'luxon')('should support day with letter suffix', () => { testFieldChange({ format: adapter.lib === 'date-fns' ? 'do' : 'Do', keyStrokes: [ @@ -1713,7 +1711,7 @@ describe(' - Editing', () => { expectFieldValueV6(input, 'MM/DD/YYYY'); }); - testSkipIf(adapter.lib !== 'dayjs')( + it.skipIf(adapter.lib !== 'dayjs')( 'should reset the input query state on an unfocused field', async () => { // Test with accessible DOM structure diff --git a/packages/x-date-pickers/src/DateField/tests/editingKeyboard.DateField.test.tsx b/packages/x-date-pickers/src/DateField/tests/editingKeyboard.DateField.test.tsx index 91de276e9a0a7..d7b566f157a81 100644 --- a/packages/x-date-pickers/src/DateField/tests/editingKeyboard.DateField.test.tsx +++ b/packages/x-date-pickers/src/DateField/tests/editingKeyboard.DateField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { spy } from 'sinon'; import { DateField } from '@mui/x-date-pickers/DateField'; import { fireEvent } from '@mui/internal-test-utils'; diff --git a/packages/x-date-pickers/src/DateField/tests/format.DateField.test.tsx b/packages/x-date-pickers/src/DateField/tests/format.DateField.test.tsx index 5734284827042..38b69c2a35716 100644 --- a/packages/x-date-pickers/src/DateField/tests/format.DateField.test.tsx +++ b/packages/x-date-pickers/src/DateField/tests/format.DateField.test.tsx @@ -6,7 +6,6 @@ import { describeAdapters, } from 'test/utils/pickers'; import { DateField } from '@mui/x-date-pickers/DateField'; -import { testSkipIf } from 'test/utils/skipIf'; describeAdapters(' - Format', DateField, ({ adapter, renderWithProps }) => { const { start: startChar, end: endChar } = adapter.escapedCharacters; @@ -72,7 +71,7 @@ describeAdapters(' - Format', DateField, ({ adapter, renderWithProp // If your start character and end character are equal // Then you can't have nested escaped characters - testSkipIf(startChar === endChar)('should support nested escaped characters', () => { + it.skipIf(startChar === endChar)('should support nested escaped characters', () => { // Test with accessible DOM structure let view = renderWithProps({ enableAccessibleFieldDOMStructure: true, diff --git a/packages/x-date-pickers/src/DateField/tests/selection.DateField.test.tsx b/packages/x-date-pickers/src/DateField/tests/selection.DateField.test.tsx index 08fe610a5098a..3949682e58d45 100644 --- a/packages/x-date-pickers/src/DateField/tests/selection.DateField.test.tsx +++ b/packages/x-date-pickers/src/DateField/tests/selection.DateField.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { DateField } from '@mui/x-date-pickers/DateField'; import { act, fireEvent, screen, waitFor } from '@mui/internal-test-utils'; import { diff --git a/packages/x-date-pickers/src/DatePicker/tests/DatePicker.test.tsx b/packages/x-date-pickers/src/DatePicker/tests/DatePicker.test.tsx index ec641adf481a5..c6e21955ca15e 100644 --- a/packages/x-date-pickers/src/DatePicker/tests/DatePicker.test.tsx +++ b/packages/x-date-pickers/src/DatePicker/tests/DatePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker'; import { screen } from '@mui/internal-test-utils'; diff --git a/packages/x-date-pickers/src/DateTimeField/tests/editing.DateTimeField.test.tsx b/packages/x-date-pickers/src/DateTimeField/tests/editing.DateTimeField.test.tsx index 6aadfddba62e1..7d627d1d2b9fa 100644 --- a/packages/x-date-pickers/src/DateTimeField/tests/editing.DateTimeField.test.tsx +++ b/packages/x-date-pickers/src/DateTimeField/tests/editing.DateTimeField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent } from '@mui/internal-test-utils'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; diff --git a/packages/x-date-pickers/src/DateTimeField/tests/timezone.DateTimeField.test.tsx b/packages/x-date-pickers/src/DateTimeField/tests/timezone.DateTimeField.test.tsx index e5d699b1dcfe5..7caf509c68205 100644 --- a/packages/x-date-pickers/src/DateTimeField/tests/timezone.DateTimeField.test.tsx +++ b/packages/x-date-pickers/src/DateTimeField/tests/timezone.DateTimeField.test.tsx @@ -1,5 +1,4 @@ import { spy } from 'sinon'; -import { expect } from 'chai'; import { DateTime } from 'luxon'; import { fireEvent } from '@mui/internal-test-utils'; import { DateTimeField } from '@mui/x-date-pickers/DateTimeField'; @@ -9,13 +8,12 @@ import { describeAdapters, buildFieldInteractions, } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; const TIMEZONE_TO_TEST = ['UTC', 'system', 'America/New_York']; describe(' - Timezone', () => { describeAdapters('Timezone prop', DateTimeField, ({ adapter, renderWithProps }) => { - describeSkipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { + describe.skipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { const format = `${adapter.formats.keyboardDate} ${adapter.formats.hours24h}`; const fillEmptyValue = (v7Response: ReturnType, timezone: string) => { diff --git a/packages/x-date-pickers/src/DateTimePicker/tests/DateTimePicker.test.tsx b/packages/x-date-pickers/src/DateTimePicker/tests/DateTimePicker.test.tsx index 7b583b1c268ba..b0b8ae3d8ddfb 100644 --- a/packages/x-date-pickers/src/DateTimePicker/tests/DateTimePicker.test.tsx +++ b/packages/x-date-pickers/src/DateTimePicker/tests/DateTimePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; import { screen } from '@mui/internal-test-utils/createRenderer'; import { createPickerRenderer, stubMatchMedia } from 'test/utils/pickers'; diff --git a/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx b/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx index 6c718efc2dba5..4b616b9db06d3 100644 --- a/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx +++ b/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx @@ -1,12 +1,11 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { TransitionProps } from '@mui/material/transitions'; import { inputBaseClasses } from '@mui/material/InputBase'; import { act, screen } from '@mui/internal-test-utils'; import { DesktopDatePicker } from '@mui/x-date-pickers/DesktopDatePicker'; import { createPickerRenderer, adapterToUse, openPickerAsync } from 'test/utils/pickers'; -import { describeSkipIf, testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { PickersActionBar, PickersActionBarAction } from '@mui/x-date-pickers/PickersActionBar'; describe('', () => { @@ -96,7 +95,7 @@ describe('', () => { expect(screen.getByRole('radio', { checked: true, name: 'January' })).not.to.equal(null); }); - testSkipIf(isJSDOM)('should move the focus to the newly opened views', async () => { + it.skipIf(isJSDOM)('should move the focus to the newly opened views', async () => { const { user } = render( , ); @@ -131,7 +130,7 @@ describe('', () => { }); // JSDOM has neither layout nor window.scrollTo - describeSkipIf(isJSDOM)('scroll', () => { + describe.skipIf(isJSDOM)('scroll', () => { const NoTransition = React.forwardRef(function NoTransition( props: TransitionProps & { children?: React.ReactNode }, ref: React.Ref, diff --git a/packages/x-date-pickers/src/DesktopDateTimePicker/tests/DesktopDateTimePicker.test.tsx b/packages/x-date-pickers/src/DesktopDateTimePicker/tests/DesktopDateTimePicker.test.tsx index 4f4fcfd66ebbf..29dfa8f50a453 100644 --- a/packages/x-date-pickers/src/DesktopDateTimePicker/tests/DesktopDateTimePicker.test.tsx +++ b/packages/x-date-pickers/src/DesktopDateTimePicker/tests/DesktopDateTimePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { screen } from '@mui/internal-test-utils'; import { DesktopDateTimePicker } from '@mui/x-date-pickers/DesktopDateTimePicker'; diff --git a/packages/x-date-pickers/src/DesktopDateTimePicker/tests/describeConformance.DesktopDateTimePicker.test.tsx b/packages/x-date-pickers/src/DesktopDateTimePicker/tests/describeConformance.DesktopDateTimePicker.test.tsx index f91416a63314f..c362884f35b31 100644 --- a/packages/x-date-pickers/src/DesktopDateTimePicker/tests/describeConformance.DesktopDateTimePicker.test.tsx +++ b/packages/x-date-pickers/src/DesktopDateTimePicker/tests/describeConformance.DesktopDateTimePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { createPickerRenderer, describePicker } from 'test/utils/pickers'; import { DesktopDateTimePicker } from '@mui/x-date-pickers/DesktopDateTimePicker'; diff --git a/packages/x-date-pickers/src/DesktopTimePicker/tests/DesktopTimePicker.test.tsx b/packages/x-date-pickers/src/DesktopTimePicker/tests/DesktopTimePicker.test.tsx index 74744202621b6..adb877e9bd423 100644 --- a/packages/x-date-pickers/src/DesktopTimePicker/tests/DesktopTimePicker.test.tsx +++ b/packages/x-date-pickers/src/DesktopTimePicker/tests/DesktopTimePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { screen } from '@mui/internal-test-utils'; import { DesktopTimePicker } from '@mui/x-date-pickers/DesktopTimePicker'; diff --git a/packages/x-date-pickers/src/DigitalClock/tests/DigitalClock.test.tsx b/packages/x-date-pickers/src/DigitalClock/tests/DigitalClock.test.tsx index 2358722b10bd0..a320d7859f510 100644 --- a/packages/x-date-pickers/src/DigitalClock/tests/DigitalClock.test.tsx +++ b/packages/x-date-pickers/src/DigitalClock/tests/DigitalClock.test.tsx @@ -1,6 +1,5 @@ /* eslint-disable material-ui/disallow-active-element-as-key-event-target */ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { DigitalClock } from '@mui/x-date-pickers/DigitalClock'; import { diff --git a/packages/x-date-pickers/src/DigitalClock/tests/describeValue.DigitalClock.test.tsx b/packages/x-date-pickers/src/DigitalClock/tests/describeValue.DigitalClock.test.tsx index b9a734001055d..07eca078eccdd 100644 --- a/packages/x-date-pickers/src/DigitalClock/tests/describeValue.DigitalClock.test.tsx +++ b/packages/x-date-pickers/src/DigitalClock/tests/describeValue.DigitalClock.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { createPickerRenderer, diff --git a/packages/x-date-pickers/src/DigitalClock/tests/timezone.DigitalClock.test.tsx b/packages/x-date-pickers/src/DigitalClock/tests/timezone.DigitalClock.test.tsx index a32fe7b983893..4fc622ee065c2 100644 --- a/packages/x-date-pickers/src/DigitalClock/tests/timezone.DigitalClock.test.tsx +++ b/packages/x-date-pickers/src/DigitalClock/tests/timezone.DigitalClock.test.tsx @@ -1,10 +1,8 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { DigitalClock } from '@mui/x-date-pickers/DigitalClock'; import { getDateOffset, describeAdapters } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; const TIMEZONE_TO_TEST = ['UTC', 'system', 'America/New_York']; @@ -18,7 +16,7 @@ const get24HourFromDigitalClock = () => { describe(' - Timezone', () => { describeAdapters('Timezone prop', DigitalClock, ({ adapter, render }) => { - describeSkipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { + describe.skipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { it('should use default timezone for rendering and onChange when no value and no timezone prop are provided', () => { const onChange = spy(); render(); diff --git a/packages/x-date-pickers/src/LocalizationProvider/LocalizationProvider.test.tsx b/packages/x-date-pickers/src/LocalizationProvider/LocalizationProvider.test.tsx index d7722e1f3ad69..1e1a3b9967147 100644 --- a/packages/x-date-pickers/src/LocalizationProvider/LocalizationProvider.test.tsx +++ b/packages/x-date-pickers/src/LocalizationProvider/LocalizationProvider.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { createRenderer } from '@mui/internal-test-utils'; import { createTheme, ThemeProvider } from '@mui/material/styles'; diff --git a/packages/x-date-pickers/src/MobileDatePicker/tests/MobileDatePicker.test.tsx b/packages/x-date-pickers/src/MobileDatePicker/tests/MobileDatePicker.test.tsx index 4c08a622dfeca..2ecd343749e01 100644 --- a/packages/x-date-pickers/src/MobileDatePicker/tests/MobileDatePicker.test.tsx +++ b/packages/x-date-pickers/src/MobileDatePicker/tests/MobileDatePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { PickersDay } from '@mui/x-date-pickers/PickersDay'; diff --git a/packages/x-date-pickers/src/MobileDateTimePicker/tests/MobileDateTimePicker.test.tsx b/packages/x-date-pickers/src/MobileDateTimePicker/tests/MobileDateTimePicker.test.tsx index 0e150f07a9927..50c51e36b505f 100644 --- a/packages/x-date-pickers/src/MobileDateTimePicker/tests/MobileDateTimePicker.test.tsx +++ b/packages/x-date-pickers/src/MobileDateTimePicker/tests/MobileDateTimePicker.test.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { MobileDateTimePicker } from '@mui/x-date-pickers/MobileDateTimePicker'; import { adapterToUse, createPickerRenderer, openPicker } from 'test/utils/pickers'; -import { hasTouchSupport, testSkipIf } from 'test/utils/skipIf'; +import { hasTouchSupport } from 'test/utils/skipIf'; describe('', () => { const { render } = createPickerRenderer(); @@ -78,7 +77,7 @@ describe('', () => { }); describe('picker state', () => { - testSkipIf(!hasTouchSupport)('should call onChange when selecting each view', async () => { + it.skipIf(!hasTouchSupport)('should call onChange when selecting each view', async () => { const onChange = spy(); const onAccept = spy(); const onClose = spy(); diff --git a/packages/x-date-pickers/src/MobileTimePicker/tests/MobileTimePicker.test.tsx b/packages/x-date-pickers/src/MobileTimePicker/tests/MobileTimePicker.test.tsx index 19db4ec0c9111..17951852c9baa 100644 --- a/packages/x-date-pickers/src/MobileTimePicker/tests/MobileTimePicker.test.tsx +++ b/packages/x-date-pickers/src/MobileTimePicker/tests/MobileTimePicker.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { MobileTimePicker } from '@mui/x-date-pickers/MobileTimePicker'; import { @@ -9,7 +8,7 @@ import { openPicker, getClockTouchEvent, } from 'test/utils/pickers'; -import { testSkipIf, hasTouchSupport } from 'test/utils/skipIf'; +import { hasTouchSupport } from 'test/utils/skipIf'; describe('', () => { const { render } = createPickerRenderer(); @@ -34,7 +33,7 @@ describe('', () => { expect(handleChange.firstCall.args[0]).toEqualDateTime(new Date(2019, 0, 1, 16, 20)); }); - testSkipIf(!hasTouchSupport)('should call onChange when selecting each view', async () => { + it.skipIf(!hasTouchSupport)('should call onChange when selecting each view', async () => { const onChange = spy(); const onAccept = spy(); const onClose = spy(); diff --git a/packages/x-date-pickers/src/MobileTimePicker/tests/timezone.MobileTimePicker.test.tsx b/packages/x-date-pickers/src/MobileTimePicker/tests/timezone.MobileTimePicker.test.tsx index 47834200f5a0b..4fc28cab25234 100644 --- a/packages/x-date-pickers/src/MobileTimePicker/tests/timezone.MobileTimePicker.test.tsx +++ b/packages/x-date-pickers/src/MobileTimePicker/tests/timezone.MobileTimePicker.test.tsx @@ -2,12 +2,10 @@ import * as React from 'react'; import { screen } from '@mui/internal-test-utils'; import { describeAdapters } from 'test/utils/pickers'; import { MobileTimePicker } from '@mui/x-date-pickers/MobileTimePicker'; -import { expect } from 'chai'; -import { describeSkipIf } from 'test/utils/skipIf'; describe(' - Timezone', () => { describeAdapters('Timezone prop', MobileTimePicker, ({ adapter, render }) => { - describeSkipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { + describe.skipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { it('should use the timezone prop for the value displayed in the toolbar', () => { render( ', () => { const { render } = createPickerRenderer(); @@ -41,14 +40,14 @@ describe('', () => { ); } - testSkipIf(isJSDOM)('should take focus when `autoFocus=true`', () => { + it.skipIf(isJSDOM)('should take focus when `autoFocus=true`', () => { render(); const isInside = document.getElementById('pickerWrapper')?.contains(document.activeElement); expect(isInside).to.equal(true); }); - testSkipIf(isJSDOM)('should not take focus when `autoFocus=false`', () => { + it.skipIf(isJSDOM)('should not take focus when `autoFocus=false`', () => { render(); const isInside = document.getElementById('pickerWrapper')?.contains(document.activeElement); diff --git a/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx b/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx index 5977562d07102..4ffdf9923ab28 100644 --- a/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx +++ b/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { act, fireEvent, screen } from '@mui/internal-test-utils'; import { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker'; import { DateView } from '@mui/x-date-pickers/models'; diff --git a/packages/x-date-pickers/src/StaticDateTimePicker/tests/StaticDateTimePicker.test.tsx b/packages/x-date-pickers/src/StaticDateTimePicker/tests/StaticDateTimePicker.test.tsx index f66122fd10103..95b09a2b160db 100644 --- a/packages/x-date-pickers/src/StaticDateTimePicker/tests/StaticDateTimePicker.test.tsx +++ b/packages/x-date-pickers/src/StaticDateTimePicker/tests/StaticDateTimePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { StaticDateTimePicker } from '@mui/x-date-pickers/StaticDateTimePicker'; diff --git a/packages/x-date-pickers/src/StaticTimePicker/StaticTimePicker.test.tsx b/packages/x-date-pickers/src/StaticTimePicker/StaticTimePicker.test.tsx index 6b5ae8168c40c..bebc63f404195 100644 --- a/packages/x-date-pickers/src/StaticTimePicker/StaticTimePicker.test.tsx +++ b/packages/x-date-pickers/src/StaticTimePicker/StaticTimePicker.test.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireTouchChangedEvent, screen, within, fireEvent } from '@mui/internal-test-utils'; import { adapterToUse, createPickerRenderer, describeValidation } from 'test/utils/pickers'; import { StaticTimePicker } from '@mui/x-date-pickers/StaticTimePicker'; import { describeConformance } from 'test/utils/describeConformance'; -import { testSkipIf, hasTouchSupport } from 'test/utils/skipIf'; +import { hasTouchSupport } from 'test/utils/skipIf'; describe('', () => { const { render } = createPickerRenderer({ @@ -34,7 +33,7 @@ describe('', () => { ], })); - testSkipIf(!hasTouchSupport)( + it.skipIf(!hasTouchSupport)( 'should allow view modification, but not update value when `readOnly` prop is passed', () => { const selectEvent = { @@ -83,7 +82,7 @@ describe('', () => { }, ); - testSkipIf(!hasTouchSupport)( + it.skipIf(!hasTouchSupport)( 'should allow switching between views and display disabled options when `disabled` prop is passed', () => { const selectEvent = { diff --git a/packages/x-date-pickers/src/TimeClock/tests/TimeClock.test.tsx b/packages/x-date-pickers/src/TimeClock/tests/TimeClock.test.tsx index bde9b5d43fe36..7efdd5e08351d 100644 --- a/packages/x-date-pickers/src/TimeClock/tests/TimeClock.test.tsx +++ b/packages/x-date-pickers/src/TimeClock/tests/TimeClock.test.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, fireTouchChangedEvent, screen, within } from '@mui/internal-test-utils'; import { TimeClock } from '@mui/x-date-pickers/TimeClock'; import { createPickerRenderer, adapterToUse, timeClockHandler } from 'test/utils/pickers'; -import { testSkipIf, hasTouchSupport, describeSkipIf } from 'test/utils/skipIf'; +import { hasTouchSupport } from 'test/utils/skipIf'; describe('', () => { const { render } = createPickerRenderer(); @@ -221,7 +220,7 @@ describe('', () => { }); }); - testSkipIf(!hasTouchSupport)( + it.skipIf(!hasTouchSupport)( 'should display options, but not update value when readOnly prop is passed', () => { const selectEvent = { @@ -250,7 +249,7 @@ describe('', () => { }, ); - testSkipIf(!hasTouchSupport)( + it.skipIf(!hasTouchSupport)( 'should display disabled options when disabled prop is passed', () => { const selectEvent = { @@ -279,7 +278,7 @@ describe('', () => { }, ); - describeSkipIf(!hasTouchSupport)('Time validation on touch ', () => { + describe.skipIf(!hasTouchSupport)('Time validation on touch ', () => { const clockTouchEvent = { '13:--': { changedTouches: [ diff --git a/packages/x-date-pickers/src/TimeClock/tests/describeValue.TimeClock.test.tsx b/packages/x-date-pickers/src/TimeClock/tests/describeValue.TimeClock.test.tsx index 352d36e8bec26..dfeb603f59e03 100644 --- a/packages/x-date-pickers/src/TimeClock/tests/describeValue.TimeClock.test.tsx +++ b/packages/x-date-pickers/src/TimeClock/tests/describeValue.TimeClock.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { clockPointerClasses, TimeClock } from '@mui/x-date-pickers/TimeClock'; import { diff --git a/packages/x-date-pickers/src/TimeClock/tests/timezone.TimeClock.test.tsx b/packages/x-date-pickers/src/TimeClock/tests/timezone.TimeClock.test.tsx index 5bacfaed27e37..3b93e6dfa41df 100644 --- a/packages/x-date-pickers/src/TimeClock/tests/timezone.TimeClock.test.tsx +++ b/packages/x-date-pickers/src/TimeClock/tests/timezone.TimeClock.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { screen, fireTouchChangedEvent } from '@mui/internal-test-utils'; import { TimeClock } from '@mui/x-date-pickers/TimeClock'; import { @@ -9,13 +8,12 @@ import { getDateOffset, describeAdapters, } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; const TIMEZONE_TO_TEST = ['UTC', 'system', 'America/New_York']; describe(' - Timezone', () => { describeAdapters('Timezone prop', TimeClock, ({ adapter, render }) => { - describeSkipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { + describe.skipIf(!adapter.isTimezoneCompatible)('timezoneCompatible', () => { it('should use default timezone for rendering and onChange when no value and no timezone prop are provided', () => { const onChange = spy(); render(); diff --git a/packages/x-date-pickers/src/TimeField/tests/editing.TimeField.test.tsx b/packages/x-date-pickers/src/TimeField/tests/editing.TimeField.test.tsx index ba03225d0e1ba..e3f550075a73d 100644 --- a/packages/x-date-pickers/src/TimeField/tests/editing.TimeField.test.tsx +++ b/packages/x-date-pickers/src/TimeField/tests/editing.TimeField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { spy } from 'sinon'; import { TimeField } from '@mui/x-date-pickers/TimeField'; import { fireEvent } from '@mui/internal-test-utils'; diff --git a/packages/x-date-pickers/src/TimePicker/tests/TimePicker.test.tsx b/packages/x-date-pickers/src/TimePicker/tests/TimePicker.test.tsx index 46a0c2bd969b9..6bf84d092df59 100644 --- a/packages/x-date-pickers/src/TimePicker/tests/TimePicker.test.tsx +++ b/packages/x-date-pickers/src/TimePicker/tests/TimePicker.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { TimePicker } from '@mui/x-date-pickers/TimePicker'; import { screen } from '@mui/internal-test-utils/createRenderer'; import { createPickerRenderer, stubMatchMedia } from 'test/utils/pickers'; diff --git a/packages/x-date-pickers/src/YearCalendar/tests/YearCalendar.test.tsx b/packages/x-date-pickers/src/YearCalendar/tests/YearCalendar.test.tsx index 841ac200afc5f..704782aa3cf0f 100644 --- a/packages/x-date-pickers/src/YearCalendar/tests/YearCalendar.test.tsx +++ b/packages/x-date-pickers/src/YearCalendar/tests/YearCalendar.test.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { spy } from 'sinon'; -import { expect } from 'chai'; import { act, fireEvent, screen } from '@mui/internal-test-utils'; import { YearCalendar } from '@mui/x-date-pickers/YearCalendar'; import { createPickerRenderer, adapterToUse } from 'test/utils/pickers'; diff --git a/packages/x-date-pickers/src/YearCalendar/tests/describeValue.YearCalendar.test.tsx b/packages/x-date-pickers/src/YearCalendar/tests/describeValue.YearCalendar.test.tsx index 3e6c235807802..a8c9880f229f9 100644 --- a/packages/x-date-pickers/src/YearCalendar/tests/describeValue.YearCalendar.test.tsx +++ b/packages/x-date-pickers/src/YearCalendar/tests/describeValue.YearCalendar.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { YearCalendar } from '@mui/x-date-pickers/YearCalendar'; import { createPickerRenderer, adapterToUse, describeValue } from 'test/utils/pickers'; diff --git a/packages/x-date-pickers/src/YearCalendar/tests/keyboard.YearCalendar.test.tsx b/packages/x-date-pickers/src/YearCalendar/tests/keyboard.YearCalendar.test.tsx index 5067f3003bbfc..e4d050cf1b054 100644 --- a/packages/x-date-pickers/src/YearCalendar/tests/keyboard.YearCalendar.test.tsx +++ b/packages/x-date-pickers/src/YearCalendar/tests/keyboard.YearCalendar.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { YearCalendar } from '@mui/x-date-pickers/YearCalendar'; import { createPickerRenderer, adapterToUse } from 'test/utils/pickers'; diff --git a/packages/x-date-pickers/src/internals/hooks/useControlledValue.test.tsx b/packages/x-date-pickers/src/internals/hooks/useControlledValue.test.tsx index 9e11d594bad4b..88c757856050e 100644 --- a/packages/x-date-pickers/src/internals/hooks/useControlledValue.test.tsx +++ b/packages/x-date-pickers/src/internals/hooks/useControlledValue.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { PickersTimezone, PickerValidDate } from '@mui/x-date-pickers/models'; import { createPickerRenderer } from 'test/utils/pickers'; diff --git a/packages/x-date-pickers/src/internals/hooks/useField/useField.test.tsx b/packages/x-date-pickers/src/internals/hooks/useField/useField.test.tsx index c78f3037f089c..5d7028ea28b72 100644 --- a/packages/x-date-pickers/src/internals/hooks/useField/useField.test.tsx +++ b/packages/x-date-pickers/src/internals/hooks/useField/useField.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { getSectionVisibleValue, parseSelectedSections } from './useField.utils'; const COMMON_PROPERTIES = { diff --git a/packages/x-date-pickers/src/internals/utils/date-utils.test.ts b/packages/x-date-pickers/src/internals/utils/date-utils.test.ts index 56c2a335252cd..27daba964dcbd 100644 --- a/packages/x-date-pickers/src/internals/utils/date-utils.test.ts +++ b/packages/x-date-pickers/src/internals/utils/date-utils.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { adapterToUse } from 'test/utils/pickers'; import { vi } from 'vitest'; import { findClosestEnabledDate } from './date-utils'; diff --git a/packages/x-date-pickers/src/tests/fieldKeyboardInteraction.test.tsx b/packages/x-date-pickers/src/tests/fieldKeyboardInteraction.test.tsx index ed575f24d0c34..ede63ae7962d0 100644 --- a/packages/x-date-pickers/src/tests/fieldKeyboardInteraction.test.tsx +++ b/packages/x-date-pickers/src/tests/fieldKeyboardInteraction.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import moment from 'moment'; import jMoment from 'moment-jalaali'; import { fireEvent } from '@mui/internal-test-utils'; @@ -61,11 +60,11 @@ describe(`RTL - test arrows navigation`, () => { adapterName: 'moment-jalaali', }); - before(() => { + beforeAll(() => { jMoment.loadPersian(); }); - after(() => { + afterAll(() => { moment.locale('en'); }); diff --git a/packages/x-date-pickers/tsconfig.json b/packages/x-date-pickers/tsconfig.json index f63ee3ebfc2ad..4882525d96241 100644 --- a/packages/x-date-pickers/tsconfig.json +++ b/packages/x-date-pickers/tsconfig.json @@ -4,8 +4,7 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], "noImplicitAny": false, diff --git a/packages/x-internals/src/fastArrayCompare/fastArrayCompare.test.ts b/packages/x-internals/src/fastArrayCompare/fastArrayCompare.test.ts index f298b46559c2f..450dd001d6787 100644 --- a/packages/x-internals/src/fastArrayCompare/fastArrayCompare.test.ts +++ b/packages/x-internals/src/fastArrayCompare/fastArrayCompare.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { fastArrayCompare } from './fastArrayCompare'; describe('fastArrayCompare', () => { diff --git a/packages/x-internals/src/isDeepEqual/isDeepEqual.test.ts b/packages/x-internals/src/isDeepEqual/isDeepEqual.test.ts index b0815951c275e..8f5813b7b9c92 100644 --- a/packages/x-internals/src/isDeepEqual/isDeepEqual.test.ts +++ b/packages/x-internals/src/isDeepEqual/isDeepEqual.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { isDeepEqual } from './isDeepEqual'; const testValues: [unknown, unknown, boolean][] = [ diff --git a/packages/x-internals/src/useComponentRenderer/useComponentRenderer.test.tsx b/packages/x-internals/src/useComponentRenderer/useComponentRenderer.test.tsx index 1b8706fdb0d1b..6f7f61d443f3b 100644 --- a/packages/x-internals/src/useComponentRenderer/useComponentRenderer.test.tsx +++ b/packages/x-internals/src/useComponentRenderer/useComponentRenderer.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, screen } from '@mui/internal-test-utils'; import { RenderProp, useComponentRenderer } from './useComponentRenderer'; diff --git a/packages/x-internals/tsconfig.json b/packages/x-internals/tsconfig.json index 359e742ef9332..51c7ca2e64adc 100644 --- a/packages/x-internals/tsconfig.json +++ b/packages/x-internals/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["node", "@mui/internal-test-utils/initMatchers", "chai-dom", "mocha"] + "types": ["node", "@mui/internal-test-utils/initMatchers", "vitest/globals"], + "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-license/src/encoding/base64.test.ts b/packages/x-license/src/encoding/base64.test.ts index 1e8fdce857742..6b7e840baceee 100644 --- a/packages/x-license/src/encoding/base64.test.ts +++ b/packages/x-license/src/encoding/base64.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { base64Decode, base64Encode } from './base64'; describe('License: base64', () => { diff --git a/packages/x-license/src/encoding/md5.test.ts b/packages/x-license/src/encoding/md5.test.ts index 3e4e5f43e40cd..3a96d58c35409 100644 --- a/packages/x-license/src/encoding/md5.test.ts +++ b/packages/x-license/src/encoding/md5.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { md5 } from './md5'; describe('License: md5', () => { diff --git a/packages/x-license/src/generateLicense/generateLicense.test.ts b/packages/x-license/src/generateLicense/generateLicense.test.ts index d09584737fd7f..d6ef8c11f73f0 100644 --- a/packages/x-license/src/generateLicense/generateLicense.test.ts +++ b/packages/x-license/src/generateLicense/generateLicense.test.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { generateLicense } from './generateLicense'; describe('License: generateLicense', () => { diff --git a/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx b/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx index fe9c3d0eb2468..79e201896d6e5 100644 --- a/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx +++ b/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createRenderer, ErrorBoundary, reactMajor, screen } from '@mui/internal-test-utils'; import { useLicenseVerifier, @@ -8,7 +7,7 @@ import { Unstable_LicenseInfoProvider as LicenseInfoProvider, MuiCommercialPackageName, } from '@mui/x-license'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { sharedLicenseStatuses } from './useLicenseVerifier'; import { generateReleaseInfo } from '../verifyLicense'; @@ -22,12 +21,11 @@ function TestComponent(props: { packageName?: MuiCommercialPackageName }) { } // Can't change the process.env.NODE_ENV in Browser -describeSkipIf(!isJSDOM)('useLicenseVerifier', () => { +describe.skipIf(!isJSDOM)('useLicenseVerifier', () => { const { render } = createRenderer(); let env: any; - // eslint-disable-next-line mocha/no-top-level-hooks beforeEach(() => { env = process.env.NODE_ENV; // Avoid Karma "Invalid left-hand side in assignment" SyntaxError @@ -35,7 +33,6 @@ describeSkipIf(!isJSDOM)('useLicenseVerifier', () => { process.env['NODE_' + 'ENV'] = 'test'; }); - // eslint-disable-next-line mocha/no-top-level-hooks afterEach(() => { // Avoid Karma "Invalid left-hand side in assignment" SyntaxError // eslint-disable-next-line no-useless-concat diff --git a/packages/x-license/src/verifyLicense/verifyLicense.test.ts b/packages/x-license/src/verifyLicense/verifyLicense.test.ts index ba2a6a461717e..0558d887adb36 100644 --- a/packages/x-license/src/verifyLicense/verifyLicense.test.ts +++ b/packages/x-license/src/verifyLicense/verifyLicense.test.ts @@ -1,5 +1,4 @@ -import { expect } from 'chai'; -import { describeSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; import { generateLicense } from '../generateLicense/generateLicense'; import { generateReleaseInfo, verifyLicense } from './verifyLicense'; import { LICENSE_STATUS } from '../utils/licenseStatus'; @@ -9,16 +8,14 @@ const releaseDate = new Date(2018, 0, 0, 0, 0, 0, 0); const RELEASE_INFO = generateReleaseInfo(releaseDate); // Can't change the process.env.NODE_ENV in Browser -describeSkipIf(!isJSDOM)('License: verifyLicense', () => { +describe.skipIf(!isJSDOM)('License: verifyLicense', () => { let env: any; - // eslint-disable-next-line mocha/no-top-level-hooks beforeEach(() => { env = process.env.NODE_ENV; process.env.NODE_ENV = 'test'; }); - // eslint-disable-next-line mocha/no-top-level-hooks afterEach(() => { process.env.NODE_ENV = env; }); diff --git a/packages/x-license/tsconfig.json b/packages/x-license/tsconfig.json index f2c43c4db2af0..3b141cbd8715e 100644 --- a/packages/x-license/tsconfig.json +++ b/packages/x-license/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["@mui/internal-test-utils/initMatchers", "chai-dom", "mocha", "node"] + "types": ["@mui/internal-test-utils/initMatchers", "vitest/globals", "node"], + "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-scheduler/src/joy/event-calendar/EventCalendar.test.tsx b/packages/x-scheduler/src/joy/event-calendar/EventCalendar.test.tsx index 23fd731ca8ecb..a8c94e55fad87 100644 --- a/packages/x-scheduler/src/joy/event-calendar/EventCalendar.test.tsx +++ b/packages/x-scheduler/src/joy/event-calendar/EventCalendar.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { DateTime } from 'luxon'; import { screen } from '@mui/internal-test-utils'; import { createSchedulerRenderer } from 'test/utils/scheduler'; diff --git a/packages/x-scheduler/tsconfig.json b/packages/x-scheduler/tsconfig.json index c688a5b492f3c..16b0259157bb4 100644 --- a/packages/x-scheduler/tsconfig.json +++ b/packages/x-scheduler/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "types": ["@mui/internal-test-utils/initMatchers", "chai-dom", "mocha", "node"], + "types": ["@mui/internal-test-utils/initMatchers", "vitest/globals", "node"], "noImplicitAny": false, "skipLibCheck": true }, diff --git a/packages/x-telemetry/src/runtime/config.test.ts b/packages/x-telemetry/src/runtime/config.test.ts index 262955c3ca26b..2972a071a1bf9 100644 --- a/packages/x-telemetry/src/runtime/config.test.ts +++ b/packages/x-telemetry/src/runtime/config.test.ts @@ -1,6 +1,5 @@ /* eslint-disable no-underscore-dangle */ -import { expect } from 'chai'; import { vi } from 'vitest'; import { muiXTelemetrySettings } from '@mui/x-telemetry'; import { getTelemetryEnvConfig } from './config'; diff --git a/packages/x-telemetry/tsconfig.json b/packages/x-telemetry/tsconfig.json index 5130f461f7f4f..9a470c53db576 100644 --- a/packages/x-telemetry/tsconfig.json +++ b/packages/x-telemetry/tsconfig.json @@ -2,7 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "skipLibCheck": true, - "types": ["@mui/internal-test-utils/initMatchers", "chai-dom", "mocha", "node", "vite/client"] + "types": ["@mui/internal-test-utils/initMatchers", "vitest/globals", "node", "vite/client"] }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-tree-view-pro/src/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.test.tsx b/packages/x-tree-view-pro/src/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.test.tsx index 43a664d86075e..8a95a0943089a 100644 --- a/packages/x-tree-view-pro/src/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.test.tsx +++ b/packages/x-tree-view-pro/src/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.test.tsx @@ -1,5 +1,4 @@ import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, createEvent } from '@mui/internal-test-utils'; import { UseTreeViewItemsReorderingSignature } from '@mui/x-tree-view-pro/internals'; @@ -8,7 +7,6 @@ import { UseTreeViewExpansionSignature, UseTreeViewItemsSignature, } from '@mui/x-tree-view/internals'; -import { describeSkipIf } from 'test/utils/skipIf'; import { chooseActionToApply } from './useTreeViewItemsReordering.utils'; import { TreeViewItemItemReorderingValidActions } from './useTreeViewItemsReordering.types'; @@ -67,18 +65,16 @@ const buildTreeViewDragInteractions = (dataTransfer: DataTransfer) => { describeTreeView< [UseTreeViewItemsReorderingSignature, UseTreeViewItemsSignature, UseTreeViewExpansionSignature] >('useTreeViewItemsReordering', ({ render, treeViewComponentName }) => { - describeSkipIf( + describe.skipIf( treeViewComponentName === 'SimpleTreeView' || treeViewComponentName === 'RichTreeView', )('reordering', () => { let dragEvents: ReturnType; - // eslint-disable-next-line mocha/no-top-level-hooks beforeEach(() => { const dataTransfer = new MockedDataTransfer(); dataTransfer.dropEffect = 'move'; dragEvents = buildTreeViewDragInteractions(dataTransfer); }); - // eslint-disable-next-line mocha/no-top-level-hooks afterEach(() => { dragEvents = {} as typeof dragEvents; }); diff --git a/packages/x-tree-view-pro/src/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.test.tsx b/packages/x-tree-view-pro/src/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.test.tsx index a1392760c5050..8d4fc7b6ef543 100644 --- a/packages/x-tree-view-pro/src/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.test.tsx +++ b/packages/x-tree-view-pro/src/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { act, fireEvent } from '@mui/internal-test-utils'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; import { TreeViewBaseItem } from '@mui/x-tree-view/models'; diff --git a/packages/x-tree-view-pro/tsconfig.json b/packages/x-tree-view-pro/tsconfig.json index 8abd09069709e..4882525d96241 100644 --- a/packages/x-tree-view-pro/tsconfig.json +++ b/packages/x-tree-view-pro/tsconfig.json @@ -4,11 +4,11 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], - "noImplicitAny": false + "noImplicitAny": false, + "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewStyleContext.test.tsx b/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewStyleContext.test.tsx index 31a1c70f6ed91..695d2499afbd0 100644 --- a/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewStyleContext.test.tsx +++ b/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewStyleContext.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { describeTreeView, DescribeTreeViewRendererReturnValue, diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.test.tsx b/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.test.tsx index 0105373eb4bbc..3713761775b6b 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.test.tsx +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; import { UseTreeViewExpansionSignature } from '@mui/x-tree-view/internals'; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.test.tsx b/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.test.tsx index 779061acf847e..72834b4f76a12 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.test.tsx +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { act, fireEvent } from '@mui/internal-test-utils'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewItems/useTreeViewItems.test.tsx b/packages/x-tree-view/src/internals/plugins/useTreeViewItems/useTreeViewItems.test.tsx index 395f568632149..53abe7639dff0 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewItems/useTreeViewItems.test.tsx +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewItems/useTreeViewItems.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { act, fireEvent, reactMajor } from '@mui/internal-test-utils'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; @@ -9,7 +8,7 @@ import { UseTreeViewSelectionSignature, } from '@mui/x-tree-view/internals'; import { TreeItemLabel } from '@mui/x-tree-view/TreeItem'; -import { describeSkipIf, testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; describeTreeView< [UseTreeViewItemsSignature, UseTreeViewExpansionSignature, UseTreeViewSelectionSignature] @@ -20,7 +19,7 @@ describeTreeView< // can't catch render errors in the browser for unknown reason // tried try-catch + error boundary + window onError preventDefault - testSkipIf(!isJSDOM)('should throw an error when two items have the same ID', () => { + it.skipIf(!isJSDOM)('should throw an error when two items have the same ID', () => { if (treeViewComponentName === 'SimpleTreeView') { expect(() => render({ items: [{ id: '1' }, { id: '1' }], withErrorBoundary: true }), @@ -45,7 +44,7 @@ describeTreeView< }); // For now, only SimpleTreeView can use custom id attributes - testSkipIf(isRichTreeView)('should be able to use a custom id attribute', () => { + it.skipIf(isRichTreeView)('should be able to use a custom id attribute', () => { const view = render({ items: [{ id: '1' }], slotProps: { @@ -113,7 +112,7 @@ describeTreeView< expect(view.getItemRoot('1')).not.to.have.attribute('aria-expanded'); }); - testSkipIf(isRichTreeView)( + it.skipIf(isRichTreeView)( 'should mark an item as not expandable if it has only empty conditional arrays', () => { const view = renderFromJSX( @@ -129,7 +128,7 @@ describeTreeView< }, ); - testSkipIf(isRichTreeView)( + it.skipIf(isRichTreeView)( 'should mark an item as expandable if it has two array as children, one of which is empty (SimpleTreeView only)', () => { const view = renderFromJSX( @@ -145,7 +144,7 @@ describeTreeView< }, ); - testSkipIf(isRichTreeView)( + it.skipIf(isRichTreeView)( 'should mark an item as not expandable if it has one array containing an empty array as a children (SimpleTreeView only)', () => { const view = renderFromJSX( @@ -160,7 +159,7 @@ describeTreeView< }, ); - testSkipIf(!isRichTreeView)('should use getItemLabel to render the label', () => { + it.skipIf(!isRichTreeView)('should use getItemLabel to render the label', () => { const view = render({ items: [{ id: '1' }, { id: '2' }], getItemLabel: (item) => `Label: ${item.id}`, @@ -170,7 +169,7 @@ describeTreeView< expect(view.getItemContent('2')).to.have.text('Label: 2'); }); - testSkipIf(!isRichTreeView)('should use getItemChildren to find children', () => { + it.skipIf(!isRichTreeView)('should use getItemChildren to find children', () => { const items = [ { id: '1', @@ -250,7 +249,7 @@ describeTreeView< }); describe('Memoization (Rich Tree View only)', () => { - testSkipIf(!isRichTreeView)( + it.skipIf(!isRichTreeView)( 'should not re-render any children when the Tree View re-renders (flat tree)', () => { const spyLabel = spy((props) => ); @@ -268,7 +267,7 @@ describeTreeView< }, ); - testSkipIf(!isRichTreeView)( + it.skipIf(!isRichTreeView)( 'should not re-render every children when updating the state on an item (flat tree)', () => { const spyLabel = spy((props) => ); @@ -290,7 +289,7 @@ describeTreeView< }, ); - testSkipIf(!isRichTreeView)( + it.skipIf(!isRichTreeView)( 'should not re-render any children when the Tree View re-renders (nested tree)', () => { const spyLabel = spy((props) => ); @@ -311,7 +310,7 @@ describeTreeView< }, ); - testSkipIf(!isRichTreeView)( + it.skipIf(!isRichTreeView)( 'should not re-render every children when updating the state on an item (nested tree)', () => { const spyLabel = spy((props) => ); @@ -340,7 +339,7 @@ describeTreeView< describe('API methods', () => { // This method is only usable with Rich Tree View components - describeSkipIf(treeViewComponentName === 'SimpleTreeView')('getItem', () => { + describe.skipIf(treeViewComponentName === 'SimpleTreeView')('getItem', () => { it('should return the tree', () => { const view = render({ items: [{ id: '1', children: [{ id: '1.1' }] }, { id: '2' }], @@ -393,10 +392,9 @@ describeTreeView< }); // This method is only usable with Rich Tree View components - describeSkipIf(treeViewComponentName === 'SimpleTreeView')( + describe.skipIf(treeViewComponentName === 'SimpleTreeView')( 'getItemTree with RichTreeView', () => { - // eslint-disable-next-line mocha/no-identical-title it('should return the tree', () => { const view = render({ items: [{ id: '1', children: [{ id: '1.1' }] }, { id: '2' }], @@ -408,7 +406,6 @@ describeTreeView< ]); }); - // eslint-disable-next-line mocha/no-identical-title it('should have up to date tree when props.items changes', () => { const view = render({ items: [{ id: '1', children: [{ id: '1.1' }] }, { id: '2' }], @@ -419,7 +416,6 @@ describeTreeView< expect(view.apiRef.current.getItemTree()).to.deep.equal([{ id: '1' }, { id: '2' }]); }); - // eslint-disable-next-line mocha/no-identical-title it('should contain custom item properties', () => { const view = render({ items: [{ id: '1', customProp: 'foo' }], @@ -433,7 +429,7 @@ describeTreeView< ); // This method is only usable with Rich Tree View components - describeSkipIf(treeViewComponentName === 'SimpleTreeView')( + describe.skipIf(treeViewComponentName === 'SimpleTreeView')( 'getItemOrderedChildrenIds', () => { it('should return the children of an item in their rendering order', () => { diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.test.tsx b/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.test.tsx index c19b809244409..4c5d013e64d7c 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.test.tsx +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { act, fireEvent } from '@mui/internal-test-utils'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; @@ -9,7 +8,6 @@ import { UseTreeViewKeyboardNavigationSignature, UseTreeViewSelectionSignature, } from '@mui/x-tree-view/internals'; -import { testSkipIf } from 'test/utils/skipIf'; describeTreeView< [ @@ -1221,7 +1219,7 @@ describeTreeView< }); // Only the SimpleTreeView can have React Element labels. - testSkipIf(treeViewComponentName !== 'SimpleTreeView')( + it.skipIf(treeViewComponentName !== 'SimpleTreeView')( 'should work with ReactElement label', () => { const view = render({ diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewLabel/useTreeViewLabel.test.tsx b/packages/x-tree-view/src/internals/plugins/useTreeViewLabel/useTreeViewLabel.test.tsx index 98bd6fe081883..aa8163bae7297 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewLabel/useTreeViewLabel.test.tsx +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewLabel/useTreeViewLabel.test.tsx @@ -1,15 +1,13 @@ -import { expect } from 'chai'; import { act, fireEvent } from '@mui/internal-test-utils'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; import { UseTreeViewLabelSignature } from '@mui/x-tree-view/internals'; -import { describeSkipIf } from 'test/utils/skipIf'; describeTreeView<[UseTreeViewLabelSignature]>( 'useTreeViewLabel plugin', ({ render, treeViewComponentName }) => { const isSimpleTreeView = treeViewComponentName.startsWith('SimpleTreeView'); - describeSkipIf(isSimpleTreeView)('interaction', () => { + describe.skipIf(isSimpleTreeView)('interaction', () => { describe('render labelInput when needed', () => { // This test is not relevant for the TreeItem component or the SimpleTreeView. it('should not render labelInput when double clicked if item is not editable', () => { @@ -172,7 +170,7 @@ describeTreeView<[UseTreeViewLabelSignature]>( }); }); }); - describeSkipIf(isSimpleTreeView)('updateItemLabel public API method', () => { + describe.skipIf(isSimpleTreeView)('updateItemLabel public API method', () => { it('should change the label value', () => { const view = render({ items: [{ id: '1', label: 'test' }], @@ -185,7 +183,7 @@ describeTreeView<[UseTreeViewLabelSignature]>( expect(view.getItemLabel('1').textContent).to.equal('new value'); }); }); - describeSkipIf(isSimpleTreeView)('setEditedItem public API method', () => { + describe.skipIf(isSimpleTreeView)('setEditedItem public API method', () => { it('should enter editing mode via setEditedItem if item is editable', () => { const view = render({ items: [{ id: '1', editable: true }], diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.test.tsx b/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.test.tsx index 1c79ef97b0176..1f4c82bcc4b0f 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.test.tsx +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.test.tsx @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, act } from '@mui/internal-test-utils'; import { describeTreeView } from 'test/utils/tree-view/describeTreeView'; @@ -81,7 +80,6 @@ describeTreeView<[UseTreeViewSelectionSignature, UseTreeViewExpansionSignature]> }); // TODO: Re-enable this test if we have a way to un-select an item in single selection. - // eslint-disable-next-line mocha/no-skipped-tests it.skip('should call onSelectedItemsChange callback when the model is updated (single selection and remove selected item', () => { const onSelectedItemsChange = spy(); diff --git a/packages/x-tree-view/src/internals/useTreeView/useTreeView.test.tsx b/packages/x-tree-view/src/internals/useTreeView/useTreeView.test.tsx index 9489bec6a86fe..0d3846c578867 100644 --- a/packages/x-tree-view/src/internals/useTreeView/useTreeView.test.tsx +++ b/packages/x-tree-view/src/internals/useTreeView/useTreeView.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { fireEvent, act } from '@mui/internal-test-utils'; import { describeTreeView, diff --git a/packages/x-tree-view/src/useTreeItem/useTreeItem.test.tsx b/packages/x-tree-view/src/useTreeItem/useTreeItem.test.tsx index 8bd9f4f3a089b..21751664e8697 100644 --- a/packages/x-tree-view/src/useTreeItem/useTreeItem.test.tsx +++ b/packages/x-tree-view/src/useTreeItem/useTreeItem.test.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { act, createEvent, fireEvent, screen } from '@mui/internal-test-utils'; import { diff --git a/packages/x-tree-view/tsconfig.json b/packages/x-tree-view/tsconfig.json index 8abd09069709e..4882525d96241 100644 --- a/packages/x-tree-view/tsconfig.json +++ b/packages/x-tree-view/tsconfig.json @@ -4,11 +4,11 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", - "mocha", + "vitest/globals", "node" ], - "noImplicitAny": false + "noImplicitAny": false, + "skipLibCheck": true }, - "include": ["src/**/*"] + "include": ["src/**/*", "../../test/utils/addChaiAssertions.ts"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f727675aa478..fceeb0549e897 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,9 +57,6 @@ catalogs: '@react-spring/web': specifier: ^10.0.1 version: 10.0.1 - '@types/chai': - specifier: ^5.2.2 - version: 5.2.2 '@types/chance': specifier: ^1.1.6 version: 1.1.6 @@ -135,9 +132,6 @@ catalogs: babel-plugin-transform-react-remove-prop-types: specifier: ^0.4.24 version: 0.4.24 - chai: - specifier: ^5.2.0 - version: 5.2.0 chance: specifier: ^1.1.13 version: 1.1.13 @@ -341,9 +335,6 @@ importers: '@types/babel__traverse': specifier: ^7.20.7 version: 7.20.7 - '@types/chai': - specifier: 'catalog:' - version: 5.2.2 '@types/chai-dom': specifier: ^1.11.3 version: 1.11.3 @@ -353,9 +344,6 @@ importers: '@types/lodash': specifier: 'catalog:' version: 4.17.17 - '@types/mocha': - specifier: ^10.0.10 - version: 10.0.10 '@types/node': specifier: ^24.0.1 version: 24.0.1 @@ -422,9 +410,6 @@ importers: babel-plugin-transform-replace-expressions: specifier: ^0.2.0 version: 0.2.0(@babel/core@7.27.4) - chai: - specifier: 'catalog:' - version: 5.2.0 chai-dom: specifier: ^1.12.1 version: 1.12.1(chai@5.2.0) @@ -482,9 +467,6 @@ importers: eslint-plugin-material-ui: specifier: workspace:^ version: link:packages/eslint-plugin-material-ui - eslint-plugin-mocha: - specifier: ^10.5.0 - version: 10.5.0(eslint@9.29.0) eslint-plugin-prettier: specifier: ^5.4.1 version: 5.4.1(@types/eslint@9.6.1)(eslint-config-prettier@10.1.5(eslint@9.29.0))(eslint@9.29.0)(prettier@3.5.3) @@ -879,9 +861,6 @@ importers: '@mui/internal-scripts': specifier: ^2.0.9 version: 2.0.9 - '@types/chai': - specifier: 'catalog:' - version: 5.2.2 '@types/chance': specifier: 'catalog:' version: 1.1.6 @@ -1991,9 +1970,6 @@ importers: '@react-spring/web': specifier: 'catalog:' version: 10.0.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - '@types/chai': - specifier: 'catalog:' - version: 5.2.2 '@types/moment-jalaali': specifier: 'catalog:' version: 0.7.9 @@ -2012,9 +1988,6 @@ importers: '@types/semver': specifier: 'catalog:' version: 7.7.0 - chai: - specifier: 'catalog:' - version: 5.2.0 dayjs: specifier: 'catalog:' version: 1.11.13 @@ -2130,9 +2103,6 @@ importers: '@playwright/test': specifier: 'catalog:' version: 1.53.0 - '@types/chai': - specifier: 'catalog:' - version: 5.2.2 '@types/moment-jalaali': specifier: 'catalog:' version: 0.7.9 @@ -2148,9 +2118,6 @@ importers: '@vitejs/plugin-react': specifier: 'catalog:' version: 4.5.2(vite@6.3.5(@types/node@24.0.1)(lightningcss@1.29.3)(terser@5.39.0)(tsx@4.20.3)(yaml@2.7.0)) - chai: - specifier: 'catalog:' - version: 5.2.0 react: specifier: 'catalog:' version: 19.0.0 @@ -2271,9 +2238,6 @@ importers: '@playwright/test': specifier: 'catalog:' version: 1.53.0 - '@types/chai': - specifier: 'catalog:' - version: 5.2.2 '@types/moment-jalaali': specifier: 'catalog:' version: 0.7.9 @@ -2289,9 +2253,6 @@ importers: '@vitejs/plugin-react': specifier: 'catalog:' version: 4.5.2(vite@6.3.5(@types/node@24.0.1)(lightningcss@1.29.3)(terser@5.39.0)(tsx@4.20.3)(yaml@2.7.0)) - chai: - specifier: 'catalog:' - version: 5.2.0 react: specifier: 'catalog:' version: 19.0.0 @@ -5596,9 +5557,6 @@ packages: '@types/minimist@1.2.5': resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} - '@types/mocha@10.0.10': - resolution: {integrity: sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==} - '@types/moment-hijri@2.1.4': resolution: {integrity: sha512-pGX1DaSducJDkJAC3q8fCuemow0pzI4oa0iKcspwQNPXuwlI55WRgBVrA6NVi+rf8bZN1qjWVsGdUatrLhZk6Q==} @@ -7637,12 +7595,6 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9 - eslint-plugin-mocha@10.5.0: - resolution: {integrity: sha512-F2ALmQVPT1GoP27O1JTZGrV9Pqg8k79OeIuvw63UxMtQKREZtmkK1NFgkZQ2TW7L2JSSFKHFPTtHu5z8R9QNRw==} - engines: {node: '>=14.0.0'} - peerDependencies: - eslint: '>=7.0.0' - eslint-plugin-prettier@5.4.1: resolution: {integrity: sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg==} engines: {node: ^14.18.0 || >=16.0.0} @@ -7689,16 +7641,6 @@ packages: resolution: {integrity: sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint-utils@3.0.0: - resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} - engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} - peerDependencies: - eslint: '>=5' - - eslint-visitor-keys@2.1.0: - resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} - engines: {node: '>=10'} - eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -8228,10 +8170,6 @@ packages: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} - globals@13.24.0: - resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} - engines: {node: '>=8'} - globals@14.0.0: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} @@ -10630,9 +10568,6 @@ packages: quote-unquote@1.0.0: resolution: {integrity: sha512-twwRO/ilhlG/FIgYeKGFqyHhoEhqgnKVkcmqMKi2r524gz3ZbDTcyFt38E9xjJI2vT+KbRNHVbnJ/e0I25Azwg==} - rambda@7.5.0: - resolution: {integrity: sha512-y/M9weqWAH4iopRd7EHDEQQvpFPHj1AA3oHozE9tfITHUtTR7Z9PSlIRRG2l1GuW7sefC1cXFfIcF+cgnShdBA==} - randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} @@ -11703,10 +11638,6 @@ packages: resolution: {integrity: sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==} engines: {node: '>=10'} - type-fest@0.20.2: - resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} - engines: {node: '>=10'} - type-fest@0.21.3: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} @@ -16540,8 +16471,6 @@ snapshots: '@types/minimist@1.2.5': {} - '@types/mocha@10.0.10': {} - '@types/moment-hijri@2.1.4': dependencies: moment: 2.30.1 @@ -18994,13 +18923,6 @@ snapshots: safe-regex-test: 1.1.0 string.prototype.includes: 2.0.1 - eslint-plugin-mocha@10.5.0(eslint@9.29.0): - dependencies: - eslint: 9.29.0 - eslint-utils: 3.0.0(eslint@9.29.0) - globals: 13.24.0 - rambda: 7.5.0 - eslint-plugin-prettier@5.4.1(@types/eslint@9.6.1)(eslint-config-prettier@10.1.5(eslint@9.29.0))(eslint@9.29.0)(prettier@3.5.3): dependencies: eslint: 9.29.0 @@ -19068,13 +18990,6 @@ snapshots: esrecurse: 4.3.0 estraverse: 5.3.0 - eslint-utils@3.0.0(eslint@9.29.0): - dependencies: - eslint: 9.29.0 - eslint-visitor-keys: 2.1.0 - - eslint-visitor-keys@2.1.0: {} - eslint-visitor-keys@3.4.3: {} eslint-visitor-keys@4.2.1: {} @@ -19737,10 +19652,6 @@ snapshots: globals@11.12.0: {} - globals@13.24.0: - dependencies: - type-fest: 0.20.2 - globals@14.0.0: {} globalthis@1.0.4: @@ -22505,8 +22416,6 @@ snapshots: quote-unquote@1.0.0: {} - rambda@7.5.0: {} - randombytes@2.1.0: dependencies: safe-buffer: 5.2.1 @@ -23762,8 +23671,6 @@ snapshots: type-fest@0.18.1: {} - type-fest@0.20.2: {} - type-fest@0.21.3: {} type-fest@0.4.1: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8e53fbfe5dadd..c9a8542185ba3 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -32,7 +32,6 @@ catalog: '@mui/utils': ^7.1.1 '@playwright/test': ^1.53.0 '@react-spring/web': ^10.0.1 - '@types/chai': ^5.2.2 '@types/chance': ^1.1.6 '@types/d3-scale': ^4.0.9 '@types/format-util': ^1.0.4 @@ -54,7 +53,6 @@ catalog: babel-plugin-optimize-clsx: ^2.6.2 babel-plugin-react-remove-properties: ^0.3.0 babel-plugin-transform-react-remove-prop-types: ^0.4.24 - chai: ^5.2.0 chance: ^1.1.13 clsx: ^2.1.1 cross-env: ^7.0.3 diff --git a/scripts/buildApiDocs/tsconfig.json b/scripts/buildApiDocs/tsconfig.json index 97bb1febd6cf9..48f8e73e69ac0 100644 --- a/scripts/buildApiDocs/tsconfig.json +++ b/scripts/buildApiDocs/tsconfig.json @@ -7,7 +7,7 @@ "resolveJsonModule": true, "skipLibCheck": true, "esModuleInterop": true, - "types": ["node", "mocha"], + "types": ["node", "vitest/globals"], "target": "ES2020", "module": "CommonJS", "moduleResolution": "node", diff --git a/test/e2e-website/data-grid.spec.ts b/test/e2e-website/data-grid.spec.ts index 26d75a3118b43..7948a9937b817 100644 --- a/test/e2e-website/data-grid.spec.ts +++ b/test/e2e-website/data-grid.spec.ts @@ -1,4 +1,4 @@ -import { test as base, expect, Page } from '@playwright/test'; +import { test as base, expect } from '@playwright/test'; import kebabCase from 'lodash/kebabCase'; import { TestFixture } from './playwright.config'; diff --git a/test/e2e-website/tsconfig.json b/test/e2e-website/tsconfig.json new file mode 100644 index 0000000000000..bf6d2f5712568 --- /dev/null +++ b/test/e2e-website/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": [ + "@mui/internal-test-utils/initMatchers", + "@mui/material/themeCssVarsAugmentation", + "dayjs/plugin/timezone.d.ts", + "dayjs/plugin/utc.d.ts", + "vitest/globals", + "moment-timezone" + ], + "skipLibCheck": true + } +} diff --git a/test/e2e/index.test.ts b/test/e2e/index.test.ts index b286d7572c38a..69a74ce24c715 100644 --- a/test/e2e/index.test.ts +++ b/test/e2e/index.test.ts @@ -1,5 +1,4 @@ import { platform } from 'node:os'; -import { expect } from 'chai'; import { chromium, webkit, @@ -140,13 +139,10 @@ async function initializeEnvironment( [chromium, webkit, firefox].forEach((browserType) => { describe(`e2e: ${browserType.name()}`, () => { - // @ts-expect-error, will be defined beforeAll(async () => { await initializeEnvironment(browserType); }); - // TODO: remove with mocha types - // @ts-expect-error, will be defined afterAll(async () => { await context.close(); await browser.close(); @@ -234,7 +230,6 @@ async function initializeEnvironment( }); // this test sometimes fails on webkit for some reason - // @ts-expect-error it.skipIf(browserType.name() === 'webkit' && process.env.CIRCLECI)( 'should reorder columns by dropping into the header', async () => { @@ -329,7 +324,6 @@ async function initializeEnvironment( // if this test fails locally on chromium, be aware that it uses system locale format, // instead of one specified by the `locale` // webkit has issues with date input locale on circleci - // @ts-expect-error it.skipIf(browserType.name() === 'webkit' && process.env.CIRCLECI)( 'should edit date cells', async () => { @@ -1135,13 +1129,10 @@ async function initializeEnvironment( }); describe('e2e: chromium on Android', () => { - // @ts-expect-error, will be defined beforeAll(async () => { await initializeEnvironment(chromium, devices['Pixel 5']); }); - // TODO: remove with mocha types - // @ts-expect-error, will be defined afterAll(async () => { await context.close(); await browser.close(); diff --git a/test/e2e/package.json b/test/e2e/package.json index 0563515f5e6fc..36417eb5037f1 100644 --- a/test/e2e/package.json +++ b/test/e2e/package.json @@ -24,13 +24,11 @@ "@mui/x-internals": "workspace:^", "@mui/x-license": "workspace:*", "@playwright/test": "catalog:", - "@types/chai": "catalog:", "@types/moment-jalaali": "catalog:", "@types/react": "catalog:", "@types/react-router": "catalog:", "@types/semver": "catalog:", "@vitejs/plugin-react": "catalog:", - "chai": "catalog:", "react": "catalog:", "react-dom": "catalog:", "react-router": "catalog:", diff --git a/test/e2e/tsconfig.json b/test/e2e/tsconfig.json new file mode 100644 index 0000000000000..18bf4784b6759 --- /dev/null +++ b/test/e2e/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": [ + "@mui/internal-test-utils/initMatchers", + "@mui/material/themeCssVarsAugmentation", + "dayjs/plugin/timezone.d.ts", + "dayjs/plugin/utc.d.ts", + "vitest/globals", + "moment-timezone", + "vite/client" + ], + "skipLibCheck": true + } +} diff --git a/test/package.json b/test/package.json index 87336b899ab46..304d3da82dba9 100644 --- a/test/package.json +++ b/test/package.json @@ -21,14 +21,12 @@ "@mui/x-license": "workspace:*", "@playwright/test": "catalog:", "@react-spring/web": "catalog:", - "@types/chai": "catalog:", "@types/moment-jalaali": "catalog:", "@types/prop-types": "catalog:", "@types/react": "catalog:", "@types/react-router": "catalog:", "@types/react-transition-group": "catalog:", "@types/semver": "catalog:", - "chai": "catalog:", "dayjs": "catalog:", "moment": "catalog:", "moment-jalaali": "catalog:", diff --git a/test/regressions/index.test.ts b/test/regressions/index.test.ts index 0d0bb33c6f65b..25c8761f33f84 100644 --- a/test/regressions/index.test.ts +++ b/test/regressions/index.test.ts @@ -1,5 +1,4 @@ import * as fse from 'fs-extra'; -import { expect } from 'chai'; import * as path from 'path'; import * as childProcess from 'child_process'; import { type Browser, chromium } from '@playwright/test'; @@ -81,8 +80,6 @@ async function main() { } describe('visual regressions', () => { - // TODO: remove once mocha types are removed - // @ts-expect-error, will be set by the test afterAll(async () => { await browser.close(); }); @@ -116,7 +113,6 @@ async function main() { { timeout: getTimeout(route), }, - // @ts-expect-error, mocha types are still used async () => { if (/^\/docs-charts-tooltip.*/.test(route)) { // Ignore tooltip demo. Since they require some interaction they get tested in dedicated tests. diff --git a/test/regressions/package.json b/test/regressions/package.json index 3f30d2292c461..d9efbd36ce3d7 100644 --- a/test/regressions/package.json +++ b/test/regressions/package.json @@ -27,13 +27,11 @@ "@mui/x-tree-view": "workspace:*", "@mui/x-tree-view-pro": "workspace:*", "@playwright/test": "catalog:", - "@types/chai": "catalog:", "@types/moment-jalaali": "catalog:", "@types/react": "catalog:", "@types/react-router": "catalog:", "@types/semver": "catalog:", "@vitejs/plugin-react": "catalog:", - "chai": "catalog:", "react": "catalog:", "react-dom": "catalog:", "react-router": "catalog:", diff --git a/test/regressions/tsconfig.json b/test/regressions/tsconfig.json new file mode 100644 index 0000000000000..bf6d2f5712568 --- /dev/null +++ b/test/regressions/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": [ + "@mui/internal-test-utils/initMatchers", + "@mui/material/themeCssVarsAugmentation", + "dayjs/plugin/timezone.d.ts", + "dayjs/plugin/utc.d.ts", + "vitest/globals", + "moment-timezone" + ], + "skipLibCheck": true + } +} diff --git a/test/setupVitest.ts b/test/setupVitest.ts index aca516e3f2b2a..57be829995545 100644 --- a/test/setupVitest.ts +++ b/test/setupVitest.ts @@ -1,4 +1,4 @@ -import { beforeAll, afterAll } from 'vitest'; +import { afterAll, beforeAll, beforeEach, afterEach } from 'vitest'; import 'test/utils/addChaiAssertions'; import 'test/utils/licenseRelease'; import { generateTestLicenseKey, setupTestLicenseKey } from 'test/utils/testLicense'; @@ -11,7 +11,7 @@ import { unstable_resetCleanupTracking as unstable_resetCleanupTrackingDataGridP import { unstable_resetCleanupTracking as unstable_resetCleanupTrackingTreeView } from '@mui/x-tree-view'; import failOnConsole from 'vitest-fail-on-console'; import { clearWarningsCache } from '@mui/x-internals/warning'; -import { isJSDOM } from './utils/skipIf'; +import { hasTouchSupport, isJSDOM } from './utils/skipIf'; // Core's setupVitest is causing issues with the test setup // import '@mui/internal-test-utils/setupVitest'; @@ -50,6 +50,7 @@ configure({ failOnConsole(); +// This is necessary because core utils still use mocha global hooks if (!globalThis.before) { (globalThis as any).before = beforeAll; } @@ -58,7 +59,7 @@ if (!globalThis.after) { } // Only necessary when not in browser mode. -if (isJSDOM) { +if (!hasTouchSupport) { class Touch { instance: any; diff --git a/test/tsconfig.json b/test/tsconfig.json index 75422875100f4..ca3dd7c9c499b 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -4,15 +4,13 @@ "types": [ "@mui/internal-test-utils/initMatchers", "@mui/material/themeCssVarsAugmentation", - "chai-dom", "dayjs/plugin/timezone.d.ts", "dayjs/plugin/utc.d.ts", - "mocha", - "moment-timezone", - "vite/client" + "vite/client", + "vitest/globals", + "moment-timezone" ], "skipLibCheck": true }, - "include": ["e2e/**/*", "e2e-website/**/*", "regressions/**/*"], - "exclude": ["regressions/build/**/*", "regressions/screenshots/**/*"] + "include": ["utils/**/*", "setupVite.ts", "vite-plugin-filter-replace.mts"] } diff --git a/test/utils/addChaiAssertions.ts b/test/utils/addChaiAssertions.ts index f0235530c3949..51457242e5f48 100644 --- a/test/utils/addChaiAssertions.ts +++ b/test/utils/addChaiAssertions.ts @@ -1,5 +1,3 @@ -import * as chai from 'chai'; - import chaiDom from 'chai-dom'; import chaiPlugin from '@mui/internal-test-utils/chaiPlugin'; diff --git a/test/utils/checkMaterialVersion.ts b/test/utils/checkMaterialVersion.ts index 5038763b34ed2..0ba512f1ddfe0 100644 --- a/test/utils/checkMaterialVersion.ts +++ b/test/utils/checkMaterialVersion.ts @@ -1,7 +1,6 @@ -import { expect } from 'chai'; import semver from 'semver'; import childProcess from 'child_process'; -import { testSkipIf, isJSDOM } from 'test/utils/skipIf'; +import { isJSDOM } from 'test/utils/skipIf'; type PackageJson = { name: string; @@ -17,7 +16,7 @@ export function checkMaterialVersion({ materialPackageJson: PackageJson; testFilePath: string; }) { - testSkipIf(!isJSDOM)(`${packageJson.name} should resolve proper @mui/material version`, () => { + it.skipIf(!isJSDOM)(`${packageJson.name} should resolve proper @mui/material version`, () => { let expectedVersion = packageJson.devDependencies['@mui/material']; if (expectedVersion === 'catalog:') { diff --git a/test/utils/describeSlotsConformance.tsx b/test/utils/describeSlotsConformance.tsx index b596722026360..4abb34101c1a5 100644 --- a/test/utils/describeSlotsConformance.tsx +++ b/test/utils/describeSlotsConformance.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import createDescribe from '@mui/internal-test-utils/createDescribe'; import { MuiRenderResult } from '@mui/internal-test-utils/createRenderer'; diff --git a/test/utils/pickers/adapters.ts b/test/utils/pickers/adapters.ts index 2aa34e1d3663e..95eee4aeaa74d 100644 --- a/test/utils/pickers/adapters.ts +++ b/test/utils/pickers/adapters.ts @@ -42,8 +42,8 @@ if (/jsdom/.test(window.navigator.userAgent)) { if (flagIndex !== -1 && flagIndex + 1 < args.length) { const potentialAdapter = args[flagIndex + 1]; if (potentialAdapter) { - if (availableAdapters[potentialAdapter]) { - AdapterClassToExtend = availableAdapters[potentialAdapter]; + if (availableAdapters[potentialAdapter as AdapterName]) { + AdapterClassToExtend = availableAdapters[potentialAdapter as AdapterName]; } else { const supportedAdapters = Object.keys(availableAdapters); const message = `Error: Invalid --date-adapter value "${potentialAdapter}". Supported date adapters: ${supportedAdapters diff --git a/test/utils/pickers/assertions.ts b/test/utils/pickers/assertions.ts index c45cfa3e97647..b3e0a08dc7303 100644 --- a/test/utils/pickers/assertions.ts +++ b/test/utils/pickers/assertions.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { SinonSpy } from 'sinon'; import { cleanText, @@ -40,7 +39,7 @@ export function expectPickerChangeHandlerValue( expectedValue: any, ) { if (isPickerRangeType(type)) { - spyCallback.lastCall.firstArg.forEach((value, index) => { + spyCallback.lastCall.firstArg.forEach((value: any, index: number) => { expect(value).to.deep.equal(expectedValue[index]); }); } else { diff --git a/test/utils/pickers/describeGregorianAdapter/testCalculations.ts b/test/utils/pickers/describeGregorianAdapter/testCalculations.ts index 505c8b374b1dd..7e68304063564 100644 --- a/test/utils/pickers/describeGregorianAdapter/testCalculations.ts +++ b/test/utils/pickers/describeGregorianAdapter/testCalculations.ts @@ -1,7 +1,5 @@ -import { expect } from 'chai'; import { MuiPickersAdapter, PickersTimezone, PickerValidDate } from '@mui/x-date-pickers/models'; import { getDateOffset } from 'test/utils/pickers'; -import { testSkipIf } from 'test/utils/skipIf'; import { DescribeGregorianAdapterTestSuite } from './describeGregorianAdapter.types'; import { TEST_DATE_ISO_STRING, TEST_DATE_LOCALE_STRING } from './describeGregorianAdapter.utils'; @@ -93,7 +91,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ } }); - testSkipIf(adapterTZ.lib !== 'dayjs')('should parse undefined', () => { + it.skipIf(adapterTZ.lib !== 'dayjs')('should parse undefined', () => { if (adapter.isTimezoneCompatible) { const testTodayZone = (timezone: PickersTimezone) => { const dateWithZone = adapterTZ.date(undefined, timezone); @@ -120,7 +118,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ }); }); - testSkipIf(!adapter.isTimezoneCompatible)('Method: getTimezone', () => { + it.skipIf(!adapter.isTimezoneCompatible)('Method: getTimezone', () => { const testTimezone = (timezone: string, expectedTimezone = timezone) => { expect(adapter.getTimezone(adapter.date(undefined, timezone))).to.equal(expectedTimezone); }; @@ -135,13 +133,10 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ setDefaultTimezone(undefined); }); - testSkipIf(!adapter.isTimezoneCompatible)( - 'should not mix Europe/London and UTC in winter', - () => { - const dateWithZone = adapter.date('2023-10-30T11:44:00.000Z', 'Europe/London'); - expect(adapter.getTimezone(dateWithZone)).to.equal('Europe/London'); - }, - ); + it.skipIf(!adapter.isTimezoneCompatible)('should not mix Europe/London and UTC in winter', () => { + const dateWithZone = adapter.date('2023-10-30T11:44:00.000Z', 'Europe/London'); + expect(adapter.getTimezone(dateWithZone)).to.equal('Europe/London'); + }); it('Method: setTimezone', () => { if (adapter.isTimezoneCompatible) { @@ -212,7 +207,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isEqual(null, testDateLocale)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { const dateInLondonTZ = adapterTZ.setTimezone(testDateIso, 'Europe/London'); const dateInParisTZ = adapterTZ.setTimezone(testDateIso, 'Europe/Paris'); @@ -236,7 +231,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same year when represented in their respective timezone. // The adapter should still consider that they are in the same year. const dateInLondonTZ = adapterTZ.endOfYear( @@ -265,7 +260,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same month when represented in their respective timezone. // The adapter should still consider that they are in the same month. const dateInLondonTZ = adapterTZ.endOfMonth( @@ -294,7 +289,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same day when represented in their respective timezone. // The adapter should still consider that they are in the same day. const dateInLondonTZ = adapterTZ.endOfDay( @@ -317,7 +312,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same day when represented in their respective timezone. // The adapter should still consider that they are in the same day. const dateInLondonTZ = adapterTZ.setTimezone(testDateIso, 'Europe/London'); @@ -337,7 +332,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isAfter(testDateLocale, adapter.date()!)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { const dateInLondonTZ = adapterTZ.endOfDay( adapterTZ.setTimezone(testDateIso, 'Europe/London'), ); @@ -362,7 +357,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isAfterYear(testDateLocale, nextYearLocale)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same year when represented in their respective timezone. // The adapter should still consider that they are in the same year. const dateInLondonTZ = adapterTZ.endOfYear( @@ -386,7 +381,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isAfterDay(testDateLocale, nextDayLocale)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same day when represented in their respective timezone. // The adapter should still consider that they are in the same day. const dateInLondonTZ = adapterTZ.endOfDay( @@ -422,7 +417,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isBefore(adapter.date()!, testDateLocale)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { const dateInLondonTZ = adapterTZ.endOfDay( adapterTZ.setTimezone(testDateIso, 'Europe/London'), ); @@ -447,7 +442,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isBeforeYear(testDateLocale, nextYearLocale)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same year when represented in their respective timezone. // The adapter should still consider that they are in the same year. const dateInLondonTZ = adapterTZ.endOfYear( @@ -471,7 +466,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.isBeforeDay(testDateLocale, previousDayLocale)).to.equal(false); }); - testSkipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should work with different timezones', () => { // Both dates below have the same timestamp, but they are not in the same day when represented in their respective timezone. // The adapter should still consider that they are in the same day. const dateInLondonTZ = adapterTZ.endOfDay( @@ -605,7 +600,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.endOfMonth(testDateLocale)).toEqualDateTime(expected); }); - testSkipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { expectSameTimeInMonacoTZ(adapterTZ, testDateLastNonDSTDay); expectSameTimeInMonacoTZ(adapterTZ, adapterTZ.endOfMonth(testDateLastNonDSTDay)); }); @@ -634,7 +629,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.addMonths(testDateIso, 3)).toEqualDateTime('2019-01-30T11:44:00.000Z'); }); - testSkipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { expectSameTimeInMonacoTZ(adapterTZ, testDateLastNonDSTDay); expectSameTimeInMonacoTZ(adapterTZ, adapterTZ.addMonths(testDateLastNonDSTDay, 1)); }); @@ -646,7 +641,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.addWeeks(testDateIso, -2)).toEqualDateTime('2018-10-16T11:44:00.000Z'); }); - testSkipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { expectSameTimeInMonacoTZ(adapterTZ, testDateLastNonDSTDay); expectSameTimeInMonacoTZ(adapterTZ, adapterTZ.addWeeks(testDateLastNonDSTDay, 1)); }); @@ -658,7 +653,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ expect(adapter.addDays(testDateIso, -2)).toEqualDateTime('2018-10-28T11:44:00.000Z'); }); - testSkipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should update the offset when entering DST', () => { expectSameTimeInMonacoTZ(adapterTZ, testDateLastNonDSTDay); expectSameTimeInMonacoTZ(adapterTZ, adapterTZ.addDays(testDateLastNonDSTDay, 1)); }); @@ -763,7 +758,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ }); }); - testSkipIf(!adapter.isTimezoneCompatible)('should respect the DST', () => { + it.skipIf(!adapter.isTimezoneCompatible)('should respect the DST', () => { const referenceDate = adapterTZ.date('2022-03-17', 'Europe/Paris'); const weekArray = adapterTZ.getWeekArray(referenceDate); let expectedDate = adapter.startOfWeek(adapter.startOfMonth(referenceDate)); diff --git a/test/utils/pickers/describeGregorianAdapter/testFormat.ts b/test/utils/pickers/describeGregorianAdapter/testFormat.ts index 2ff69e4914182..97c0b8e41e8e6 100644 --- a/test/utils/pickers/describeGregorianAdapter/testFormat.ts +++ b/test/utils/pickers/describeGregorianAdapter/testFormat.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { AdapterFormats } from '@mui/x-date-pickers/models'; import { DescribeGregorianAdapterTestSuite } from './describeGregorianAdapter.types'; diff --git a/test/utils/pickers/describeGregorianAdapter/testLocalization.ts b/test/utils/pickers/describeGregorianAdapter/testLocalization.ts index d9db730093664..5f9dba7e4415c 100644 --- a/test/utils/pickers/describeGregorianAdapter/testLocalization.ts +++ b/test/utils/pickers/describeGregorianAdapter/testLocalization.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { AdapterFormats } from '@mui/x-date-pickers/models'; import { cleanText } from 'test/utils/pickers'; import moment from 'moment'; diff --git a/test/utils/pickers/describeHijriAdapter/describeHijriAdapter.ts b/test/utils/pickers/describeHijriAdapter/describeHijriAdapter.ts index 21b591e25eb91..3246db74af02a 100644 --- a/test/utils/pickers/describeHijriAdapter/describeHijriAdapter.ts +++ b/test/utils/pickers/describeHijriAdapter/describeHijriAdapter.ts @@ -18,11 +18,11 @@ function innerJalaliDescribeAdapter( }; if (params.before) { - before(params.before); + beforeAll(params.before); } if (params.after) { - after(params.after); + afterAll(params.after); } testCalculations(testSuitParams); diff --git a/test/utils/pickers/describeHijriAdapter/testCalculations.ts b/test/utils/pickers/describeHijriAdapter/testCalculations.ts index 5a797868ff064..f385edd64d5f1 100644 --- a/test/utils/pickers/describeHijriAdapter/testCalculations.ts +++ b/test/utils/pickers/describeHijriAdapter/testCalculations.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DescribeHijriAdapterTestSuite } from './describeHijriAdapter.types'; import { TEST_DATE_ISO_STRING } from '../describeGregorianAdapter'; diff --git a/test/utils/pickers/describeHijriAdapter/testFormat.ts b/test/utils/pickers/describeHijriAdapter/testFormat.ts index 6a22c488298f9..ecf2c3953a7c0 100644 --- a/test/utils/pickers/describeHijriAdapter/testFormat.ts +++ b/test/utils/pickers/describeHijriAdapter/testFormat.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DescribeHijriAdapterTestSuite } from './describeHijriAdapter.types'; export const testFormat: DescribeHijriAdapterTestSuite = ({ adapter }) => { diff --git a/test/utils/pickers/describeHijriAdapter/testLocalization.ts b/test/utils/pickers/describeHijriAdapter/testLocalization.ts index 8bb296ea9c6a6..dadf047d8e828 100644 --- a/test/utils/pickers/describeHijriAdapter/testLocalization.ts +++ b/test/utils/pickers/describeHijriAdapter/testLocalization.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DescribeHijriAdapterTestSuite } from './describeHijriAdapter.types'; export const testLocalization: DescribeHijriAdapterTestSuite = ({ adapter }) => { diff --git a/test/utils/pickers/describeJalaliAdapter/describeJalaliAdapter.ts b/test/utils/pickers/describeJalaliAdapter/describeJalaliAdapter.ts index b31048d1fcd20..d35084faae811 100644 --- a/test/utils/pickers/describeJalaliAdapter/describeJalaliAdapter.ts +++ b/test/utils/pickers/describeJalaliAdapter/describeJalaliAdapter.ts @@ -18,11 +18,11 @@ function innerJalaliDescribeAdapter( }; if (params.before) { - before(params.before); + beforeAll(params.before); } if (params.after) { - after(params.after); + afterAll(params.after); } testCalculations(testSuitParams); diff --git a/test/utils/pickers/describeJalaliAdapter/testCalculations.ts b/test/utils/pickers/describeJalaliAdapter/testCalculations.ts index c1c2d7e9f4ea9..e794922e14fdc 100644 --- a/test/utils/pickers/describeJalaliAdapter/testCalculations.ts +++ b/test/utils/pickers/describeJalaliAdapter/testCalculations.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DescribeJalaliAdapterTestSuite } from './describeJalaliAdapter.types'; import { TEST_DATE_ISO_STRING } from '../describeGregorianAdapter'; diff --git a/test/utils/pickers/describeJalaliAdapter/testFormat.ts b/test/utils/pickers/describeJalaliAdapter/testFormat.ts index 46ddbdeee294d..aaaca40964e81 100644 --- a/test/utils/pickers/describeJalaliAdapter/testFormat.ts +++ b/test/utils/pickers/describeJalaliAdapter/testFormat.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DescribeJalaliAdapterTestSuite } from './describeJalaliAdapter.types'; export const testFormat: DescribeJalaliAdapterTestSuite = ({ adapter }) => { diff --git a/test/utils/pickers/describeJalaliAdapter/testLocalization.ts b/test/utils/pickers/describeJalaliAdapter/testLocalization.ts index 5987220a291d5..bf770d513d2b0 100644 --- a/test/utils/pickers/describeJalaliAdapter/testLocalization.ts +++ b/test/utils/pickers/describeJalaliAdapter/testLocalization.ts @@ -1,4 +1,3 @@ -import { expect } from 'chai'; import { DescribeJalaliAdapterTestSuite } from './describeJalaliAdapter.types'; export const testLocalization: DescribeJalaliAdapterTestSuite = ({ adapter }) => { diff --git a/test/utils/pickers/describePicker/describePicker.tsx b/test/utils/pickers/describePicker/describePicker.tsx index cd118519b601b..13a42e92e4182 100644 --- a/test/utils/pickers/describePicker/describePicker.tsx +++ b/test/utils/pickers/describePicker/describePicker.tsx @@ -1,10 +1,7 @@ -/* eslint-env mocha */ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { screen, fireEvent, createDescribe } from '@mui/internal-test-utils'; import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import { testSkipIf } from 'test/utils/skipIf'; import { DescribePickerOptions } from './describePicker.types'; function innerDescribePicker(ElementToTest: React.ElementType, options: DescribePickerOptions) { @@ -12,7 +9,7 @@ function innerDescribePicker(ElementToTest: React.ElementType, options: Describe const propsToOpen = variant === 'static' ? {} : { open: true }; - testSkipIf(fieldType === 'multi-input' || variant === 'static')( + it.skipIf(fieldType === 'multi-input' || variant === 'static')( 'should forward the `inputRef` prop to the text field ( textfield DOM structure only)', () => { const inputRef = React.createRef(); @@ -23,7 +20,7 @@ function innerDescribePicker(ElementToTest: React.ElementType, options: Describe ); describe('Localization', () => { - testSkipIf(Boolean(hasNoView))('should respect the `localeText` prop', () => { + it.skipIf(Boolean(hasNoView))('should respect the `localeText` prop', () => { render( { - testSkipIf(variant === 'static' || fieldType === 'multi-input')( + it.skipIf(variant === 'static' || fieldType === 'multi-input')( 'should render custom component', () => { function HomeIcon(props: SvgIconProps) { @@ -62,65 +59,59 @@ function innerDescribePicker(ElementToTest: React.ElementType, options: Describe }); describe('Component slot: DesktopPaper', () => { - testSkipIf(hasNoView || variant !== 'desktop')( - 'should forward onClick and onTouchStart', - () => { - const handleClick = spy(); - const handleTouchStart = spy(); - render( - , - ); - const paper = screen.getByTestId('paper'); + it.skipIf(hasNoView || variant !== 'desktop')('should forward onClick and onTouchStart', () => { + const handleClick = spy(); + const handleTouchStart = spy(); + render( + , + ); + const paper = screen.getByTestId('paper'); - fireEvent.click(paper); - fireEvent.touchStart(paper); + fireEvent.click(paper); + fireEvent.touchStart(paper); - expect(handleClick.callCount).to.equal(1); - expect(handleTouchStart.callCount).to.equal(1); - }, - ); + expect(handleClick.callCount).to.equal(1); + expect(handleTouchStart.callCount).to.equal(1); + }); }); describe('Component slot: Popper', () => { - testSkipIf(hasNoView || variant !== 'desktop')( - 'should forward onClick and onTouchStart', - () => { - const handleClick = spy(); - const handleTouchStart = spy(); - render( - , - ); - const popper = screen.getByTestId('popper'); + it.skipIf(hasNoView || variant !== 'desktop')('should forward onClick and onTouchStart', () => { + const handleClick = spy(); + const handleTouchStart = spy(); + render( + , + ); + const popper = screen.getByTestId('popper'); - fireEvent.click(popper); - fireEvent.touchStart(popper); + fireEvent.click(popper); + fireEvent.touchStart(popper); - expect(handleClick.callCount).to.equal(1); - expect(handleTouchStart.callCount).to.equal(1); - }, - ); + expect(handleClick.callCount).to.equal(1); + expect(handleTouchStart.callCount).to.equal(1); + }); }); describe('Component slot: Toolbar', () => { - testSkipIf(Boolean(hasNoView))( + it.skipIf(Boolean(hasNoView))( 'should render toolbar on mobile but not on desktop when `hidden` is not defined', () => { render( @@ -138,7 +129,7 @@ function innerDescribePicker(ElementToTest: React.ElementType, options: Describe }, ); - testSkipIf(Boolean(hasNoView))('should render toolbar when `hidden` is `false`', () => { + it.skipIf(Boolean(hasNoView))('should render toolbar when `hidden` is `false`', () => { render( { + it.skipIf(Boolean(hasNoView))('should not render toolbar when `hidden` is `true`', () => { render( { - testSkipIf(variant === 'static')( + it.skipIf(variant === 'static')( 'should not render the open picker button, but still render the picker if its open', () => { render( @@ -188,7 +179,7 @@ function innerDescribePicker(ElementToTest: React.ElementType, options: Describe ); }); - testSkipIf(variant === 'static' || fieldType === 'multi-input')( + it.skipIf(variant === 'static' || fieldType === 'multi-input')( 'should bring the focus back to the open button when the picker is closed', async () => { const { user } = render(); diff --git a/test/utils/pickers/describeRangeValidation/describeRangeValidation.tsx b/test/utils/pickers/describeRangeValidation/describeRangeValidation.tsx index 79b0c4ee7c1e5..b6bc46c38c951 100644 --- a/test/utils/pickers/describeRangeValidation/describeRangeValidation.tsx +++ b/test/utils/pickers/describeRangeValidation/describeRangeValidation.tsx @@ -1,4 +1,3 @@ -/* eslint-env mocha */ import * as React from 'react'; import createDescribe from '@mui/internal-test-utils/createDescribe'; import { testDayViewRangeValidation } from './testDayViewRangeValidation'; @@ -18,7 +17,7 @@ function innerDescribeRangeValidation( ) { const { after: runAfterHook = () => {}, views } = getOptions(); - after(runAfterHook); + afterAll(runAfterHook); function getTestOptions() { return { diff --git a/test/utils/pickers/describeRangeValidation/testDayViewRangeValidation.tsx b/test/utils/pickers/describeRangeValidation/testDayViewRangeValidation.tsx index 8d219cde1a523..e55eac98eb404 100644 --- a/test/utils/pickers/describeRangeValidation/testDayViewRangeValidation.tsx +++ b/test/utils/pickers/describeRangeValidation/testDayViewRangeValidation.tsx @@ -1,8 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { adapterToUse } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; import { vi } from 'vitest'; import { DescribeRangeValidationTestSuite } from './describeRangeValidation.types'; @@ -38,7 +36,7 @@ export const testDayViewRangeValidation: DescribeRangeValidationTestSuite = ( getOptions, ) => { const { componentFamily, views, variant = 'desktop' } = getOptions(); - describeSkipIf(!views.includes('day') || componentFamily === 'field')( + describe.skipIf(!views.includes('day') || componentFamily === 'field')( 'validation in day view:', () => { const isDesktop = variant === 'desktop'; @@ -79,9 +77,8 @@ export const testDayViewRangeValidation: DescribeRangeValidationTestSuite = ( it('should apply disablePast', () => { const { render } = getOptions(); - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); const { referenceDate, ...otherProps } = props; return ; } @@ -114,9 +111,8 @@ export const testDayViewRangeValidation: DescribeRangeValidationTestSuite = ( it('should apply disableFuture', () => { const { render } = getOptions(); - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); const { referenceDate, ...otherProps } = props; return ; } diff --git a/test/utils/pickers/describeRangeValidation/testTextFieldKeyboardRangeValidation.tsx b/test/utils/pickers/describeRangeValidation/testTextFieldKeyboardRangeValidation.tsx index bc8d308f46161..feb22c01dd657 100644 --- a/test/utils/pickers/describeRangeValidation/testTextFieldKeyboardRangeValidation.tsx +++ b/test/utils/pickers/describeRangeValidation/testTextFieldKeyboardRangeValidation.tsx @@ -1,9 +1,7 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { adapterToUse, getAllFieldInputRoot } from 'test/utils/pickers'; import { act } from '@mui/internal-test-utils/createRenderer'; -import { describeSkipIf, testSkipIf } from 'test/utils/skipIf'; import { vi } from 'vitest'; import { DescribeRangeValidationTestSuite } from './describeRangeValidation.types'; @@ -28,7 +26,7 @@ export const testTextFieldKeyboardRangeValidation: DescribeRangeValidationTestSu ) => { const { componentFamily, render, fieldType, withDate, withTime, setValue } = getOptions(); - describeSkipIf(componentFamily !== 'field' || !setValue)('text field keyboard:', () => { + describe.skipIf(componentFamily !== 'field' || !setValue)('text field keyboard:', () => { // eslint-disable-next-line @typescript-eslint/no-shadow const setValue = getOptions().setValue!; @@ -50,7 +48,7 @@ export const testTextFieldKeyboardRangeValidation: DescribeRangeValidationTestSu testInvalidStatus([true, true], fieldType); }); - testSkipIf(!withDate)('should apply shouldDisableDate', () => { + it.skipIf(!withDate)('should apply shouldDisableDate', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply minDate', () => { const onErrorMock = spy(); render(); @@ -224,7 +222,7 @@ export const testTextFieldKeyboardRangeValidation: DescribeRangeValidationTestSu testInvalidStatus([false, false], fieldType); }); - testSkipIf(!withDate)('should apply maxDate', () => { + it.skipIf(!withDate)('should apply maxDate', () => { const onErrorMock = spy(); render(); @@ -249,7 +247,7 @@ export const testTextFieldKeyboardRangeValidation: DescribeRangeValidationTestSu testInvalidStatus([true, true], fieldType); }); - testSkipIf(!withTime)('should apply minTime', () => { + it.skipIf(!withTime)('should apply minTime', () => { const onErrorMock = spy(); render( , @@ -285,7 +283,7 @@ export const testTextFieldKeyboardRangeValidation: DescribeRangeValidationTestSu testInvalidStatus([false, false], fieldType); }); - testSkipIf(!withTime)('should apply maxTime', () => { + it.skipIf(!withTime)('should apply maxTime', () => { const onErrorMock = spy(); render( , diff --git a/test/utils/pickers/describeRangeValidation/testTextFieldRangeValidation.tsx b/test/utils/pickers/describeRangeValidation/testTextFieldRangeValidation.tsx index 3fd78a254ebb2..e1fc32a610a60 100644 --- a/test/utils/pickers/describeRangeValidation/testTextFieldRangeValidation.tsx +++ b/test/utils/pickers/describeRangeValidation/testTextFieldRangeValidation.tsx @@ -1,8 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { adapterToUse, getAllFieldInputRoot } from 'test/utils/pickers'; -import { describeSkipIf, testSkipIf } from 'test/utils/skipIf'; import { vi } from 'vitest'; import { DescribeRangeValidationTestSuite } from './describeRangeValidation.types'; @@ -27,7 +25,7 @@ export const testTextFieldRangeValidation: DescribeRangeValidationTestSuite = ( ) => { const { componentFamily, render, fieldType, withDate, withTime } = getOptions(); - describeSkipIf(!['picker', 'field'].includes(componentFamily))('text field:', () => { + describe.skipIf(!['picker', 'field'].includes(componentFamily))('text field:', () => { it('should accept single day range', () => { const onErrorMock = spy(); render( @@ -58,7 +56,7 @@ export const testTextFieldRangeValidation: DescribeRangeValidationTestSuite = ( testInvalidStatus([true, true], fieldType); }); - testSkipIf(!withDate)('should apply shouldDisableDate', () => { + it.skipIf(!withDate)('should apply shouldDisableDate', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply shouldDisableDate specifically on end date', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply shouldDisableDate specifically on start date', () => { const onErrorMock = spy(); const { setProps } = render( { const onErrorMock = spy(); - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); - let past: null | typeof now = null; + let past: null | ReturnType = null; if (withDate) { - past = adapterToUse.addDays(now, -1); - } else if (adapterToUse.isSameDay(adapterToUse.addHours(now, -1), now)) { - past = adapterToUse.addHours(now, -1); + past = adapterToUse.addDays(now!, -1); + } else if (adapterToUse.isSameDay(adapterToUse.addHours(now!, -1), now!)) { + past = adapterToUse.addHours(now!, -1); } if (past === null) { @@ -239,15 +236,14 @@ export const testTextFieldRangeValidation: DescribeRangeValidationTestSuite = ( it('should apply disableFuture', () => { const onErrorMock = spy(); - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); - let future: null | typeof now = null; + let future: null | ReturnType = null; if (withDate) { future = adapterToUse.addDays(now, 1); @@ -276,7 +272,7 @@ export const testTextFieldRangeValidation: DescribeRangeValidationTestSuite = ( testInvalidStatus([true, true], fieldType); }); - testSkipIf(!withDate)('should apply minDate', () => { + it.skipIf(!withDate)('should apply minDate', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply minDate when only first field is filled', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply minDate when only second field is filled', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply maxDate', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should apply minTime', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should ignore date when applying minTime', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should apply minTime when only first field is filled', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should apply minTime when only second field is filled', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should apply maxTime', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should ignore date when applying maxTime', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate || !withTime)('should apply maxDateTime', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate || !withTime)('should apply minDateTime', () => { const onErrorMock = spy(); const { setProps } = render( {}, views } = getOptions(); - after(runAfterHook); + afterAll(runAfterHook); function getTestOptions() { return { diff --git a/test/utils/pickers/describeValidation/testDayViewValidation.tsx b/test/utils/pickers/describeValidation/testDayViewValidation.tsx index e0949466d86c3..e69178d63905d 100644 --- a/test/utils/pickers/describeValidation/testDayViewValidation.tsx +++ b/test/utils/pickers/describeValidation/testDayViewValidation.tsx @@ -1,15 +1,13 @@ -import { expect } from 'chai'; import * as React from 'react'; import { screen } from '@mui/internal-test-utils'; import { adapterToUse } from 'test/utils/pickers'; -import { describeSkipIf, testSkipIf } from 'test/utils/skipIf'; import { SinonFakeTimers, useFakeTimers } from 'sinon'; import { DescribeValidationTestSuite } from './describeValidation.types'; export const testDayViewValidation: DescribeValidationTestSuite = (ElementToTest, getOptions) => { const { componentFamily, views, render, withDate, withTime } = getOptions(); - describeSkipIf(componentFamily === 'field' || !views.includes('day'))('day view:', () => { + describe.skipIf(componentFamily === 'field' || !views.includes('day'))('day view:', () => { const defaultProps = { onChange: () => {}, open: true, @@ -85,9 +83,8 @@ export const testDayViewValidation: DescribeValidationTestSuite = (ElementToTest timer?.restore(); }); it('should apply disablePast', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); @@ -115,9 +112,8 @@ export const testDayViewValidation: DescribeValidationTestSuite = (ElementToTest }); it('should apply disableFuture', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); @@ -180,7 +176,7 @@ export const testDayViewValidation: DescribeValidationTestSuite = (ElementToTest }); // prop only available on DateTime pickers - testSkipIf(!withDate || !withTime)('should apply maxDateTime', () => { + it.skipIf(!withDate || !withTime)('should apply maxDateTime', () => { render( { + it.skipIf(!withDate || !withTime)('should apply minDateTime', () => { render( `${String(minutes).padStart(2, '0')} minutes`; @@ -13,7 +11,7 @@ export const testMinutesViewValidation: DescribeValidationTestSuite = ( ) => { const { componentFamily, views, render, withDate, withTime, variant } = getOption(); - describeSkipIf( + describe.skipIf( !views.includes('minutes') || !variant || componentFamily !== 'picker' || variant === 'desktop', )('minutes view:', () => { const defaultProps = { @@ -57,9 +55,8 @@ export const testMinutesViewValidation: DescribeValidationTestSuite = ( }); it('should apply disablePast', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); @@ -101,9 +98,8 @@ export const testMinutesViewValidation: DescribeValidationTestSuite = ( }); it('should apply disableFuture', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); diff --git a/test/utils/pickers/describeValidation/testMonthViewValidation.tsx b/test/utils/pickers/describeValidation/testMonthViewValidation.tsx index 600bd2b6915ac..ad4375a80f6f8 100644 --- a/test/utils/pickers/describeValidation/testMonthViewValidation.tsx +++ b/test/utils/pickers/describeValidation/testMonthViewValidation.tsx @@ -1,15 +1,13 @@ -import { expect } from 'chai'; import * as React from 'react'; import { screen } from '@mui/internal-test-utils'; import { adapterToUse } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; import { SinonFakeTimers, useFakeTimers } from 'sinon'; import { DescribeValidationTestSuite } from './describeValidation.types'; export const testMonthViewValidation: DescribeValidationTestSuite = (ElementToTest, getOptions) => { const { views, componentFamily, render } = getOptions(); - describeSkipIf(componentFamily === 'field' || !views.includes('month'))('month view:', () => { + describe.skipIf(componentFamily === 'field' || !views.includes('month'))('month view:', () => { const defaultProps = { onChange: () => {}, ...(views.length > 1 && { @@ -49,9 +47,8 @@ export const testMonthViewValidation: DescribeValidationTestSuite = (ElementToTe }); it('should apply disablePast', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); @@ -81,9 +78,8 @@ export const testMonthViewValidation: DescribeValidationTestSuite = (ElementToTe }); it('should apply disableFuture', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } const { setProps } = render(); diff --git a/test/utils/pickers/describeValidation/testTextFieldValidation.tsx b/test/utils/pickers/describeValidation/testTextFieldValidation.tsx index f73a3f6be42de..a25b93272c14b 100644 --- a/test/utils/pickers/describeValidation/testTextFieldValidation.tsx +++ b/test/utils/pickers/describeValidation/testTextFieldValidation.tsx @@ -1,17 +1,15 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { TimeView } from '@mui/x-date-pickers/models'; import { adapterToUse, getFieldInputRoot } from 'test/utils/pickers'; -import { describeSkipIf, testSkipIf } from 'test/utils/skipIf'; import { vi } from 'vitest'; import { DescribeValidationTestSuite } from './describeValidation.types'; export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTest, getOptions) => { const { componentFamily, render, withDate, withTime } = getOptions(); - describeSkipIf(!['picker', 'field'].includes(componentFamily))('text field:', () => { - testSkipIf(['picker', 'field'].includes(componentFamily) && !withDate)( + describe.skipIf(!['picker', 'field'].includes(componentFamily))('text field:', () => { + it.skipIf(['picker', 'field'].includes(componentFamily) && !withDate)( 'should apply shouldDisableDate', () => { const onErrorMock = spy(); @@ -43,7 +41,7 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe ); // TODO: Remove when DateTimePickers will support those props - testSkipIf(!withDate)('should apply shouldDisableYear', () => { + it.skipIf(!withDate)('should apply shouldDisableYear', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate)('should apply shouldDisableMonth', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withTime)('should apply shouldDisableTime', () => { const onErrorMock = spy(); const { setProps } = render( { + describe.skipIf(!withDate)('with fake timers', () => { beforeEach(() => { vi.setSystemTime(new Date(2018, 0, 1)); }); @@ -148,9 +146,8 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe }); it('should apply disablePast', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } @@ -177,10 +174,9 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe }); }); - testSkipIf(!withDate)('should apply disableFuture', () => { - let now; + it.skipIf(!withDate)('should apply disableFuture', () => { + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } @@ -204,7 +200,7 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe expect(getFieldInputRoot()).to.have.attribute('aria-invalid', 'false'); }); - testSkipIf(['picker', 'field'].includes(componentFamily) && !withDate)( + it.skipIf(['picker', 'field'].includes(componentFamily) && !withDate)( 'should apply minDate', () => { const onErrorMock = spy(); @@ -233,7 +229,7 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe }, ); - testSkipIf(['picker', 'field'].includes(componentFamily) && !withDate)( + it.skipIf(['picker', 'field'].includes(componentFamily) && !withDate)( 'should apply maxDate', () => { const onErrorMock = spy(); @@ -262,7 +258,7 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe }, ); - testSkipIf(['picker', 'field'].includes(componentFamily) && !withTime)( + it.skipIf(['picker', 'field'].includes(componentFamily) && !withTime)( 'should apply minTime', () => { const onErrorMock = spy(); @@ -290,7 +286,7 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe }, ); - testSkipIf(['picker', 'field'].includes(componentFamily) && !withTime)( + it.skipIf(['picker', 'field'].includes(componentFamily) && !withTime)( 'should apply maxTime', () => { const onErrorMock = spy(); @@ -317,7 +313,7 @@ export const testTextFieldValidation: DescribeValidationTestSuite = (ElementToTe }, ); - testSkipIf(!withDate || !withTime)('should apply maxDateTime', () => { + it.skipIf(!withDate || !withTime)('should apply maxDateTime', () => { const onErrorMock = spy(); const { setProps } = render( { + it.skipIf(!withDate || !withTime)('should apply minDateTime', () => { const onErrorMock = spy(); const { setProps } = render( { const onErrorMock = spy(); diff --git a/test/utils/pickers/describeValidation/testYearViewValidation.tsx b/test/utils/pickers/describeValidation/testYearViewValidation.tsx index 5c371c5fbf34e..0865759e7a813 100644 --- a/test/utils/pickers/describeValidation/testYearViewValidation.tsx +++ b/test/utils/pickers/describeValidation/testYearViewValidation.tsx @@ -1,8 +1,6 @@ import * as React from 'react'; -import { expect } from 'chai'; import { screen } from '@mui/internal-test-utils'; import { adapterToUse } from 'test/utils/pickers'; -import { describeSkipIf } from 'test/utils/skipIf'; import { SinonFakeTimers, useFakeTimers } from 'sinon'; import { DescribeValidationTestSuite } from './describeValidation.types'; @@ -21,7 +19,7 @@ const queryByTextInView = (text: string) => { export const testYearViewValidation: DescribeValidationTestSuite = (ElementToTest, getOptions) => { const { views, componentFamily, render } = getOptions(); - describeSkipIf(componentFamily === 'field' || !views.includes('year'))('year view:', () => { + describe.skipIf(componentFamily === 'field' || !views.includes('year'))('year view:', () => { const defaultProps = { onChange: () => {}, ...(views.length > 1 && { @@ -60,9 +58,8 @@ export const testYearViewValidation: DescribeValidationTestSuite = (ElementToTes timer?.restore(); }); it('should apply disablePast', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } render(); @@ -82,9 +79,8 @@ export const testYearViewValidation: DescribeValidationTestSuite = (ElementToTes }); it('should apply disableFuture', () => { - let now; + const now = adapterToUse.date(); function WithFakeTimer(props: any) { - now = adapterToUse.date(); return ; } render(); diff --git a/test/utils/pickers/describeValue/testControlledUnControlled.tsx b/test/utils/pickers/describeValue/testControlledUnControlled.tsx index e08393a2fc721..aa756367e3aac 100644 --- a/test/utils/pickers/describeValue/testControlledUnControlled.tsx +++ b/test/utils/pickers/describeValue/testControlledUnControlled.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { screen } from '@mui/internal-test-utils'; import { inputBaseClasses } from '@mui/material/InputBase'; diff --git a/test/utils/pickers/describeValue/testPickerActionBar.tsx b/test/utils/pickers/describeValue/testPickerActionBar.tsx index 5815cfbe1bc06..50afced85a05f 100644 --- a/test/utils/pickers/describeValue/testPickerActionBar.tsx +++ b/test/utils/pickers/describeValue/testPickerActionBar.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { PickerRangeValue } from '@mui/x-date-pickers/internals'; diff --git a/test/utils/pickers/describeValue/testPickerOpenCloseLifeCycle.tsx b/test/utils/pickers/describeValue/testPickerOpenCloseLifeCycle.tsx index 87d15f9f377f8..d45e4968a9dfe 100644 --- a/test/utils/pickers/describeValue/testPickerOpenCloseLifeCycle.tsx +++ b/test/utils/pickers/describeValue/testPickerOpenCloseLifeCycle.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { config } from 'react-transition-group'; import { fireEvent, screen, waitFor } from '@mui/internal-test-utils'; @@ -13,7 +12,6 @@ import { openPickerAsync, PickerRangeComponentType, } from 'test/utils/pickers'; -import { describeSkipIf, testSkipIf } from 'test/utils/skipIf'; import { DescribeValueTestSuite } from './describeValue.types'; import { fireUserEvent } from '../../fireUserEvent'; @@ -31,7 +29,7 @@ export const testPickerOpenCloseLifeCycle: DescribeValueTestSuite { + describe.skipIf(componentFamily !== 'picker')('Picker open / close lifecycle', () => { it('should not open on mount if `props.open` is false', () => { render(); expect(screen.queryByRole(viewWrapperRole)).to.equal(null); @@ -100,7 +98,7 @@ export const testPickerOpenCloseLifeCycle: DescribeValueTestSuite { const { selectSection, pressKey } = renderWithProps( @@ -296,7 +294,7 @@ export const testPickerOpenCloseLifeCycle: DescribeValueTestSuite { const onChange = spy(); @@ -323,7 +321,7 @@ export const testPickerOpenCloseLifeCycle: DescribeValueTestSuite { const onChange = spy(); @@ -393,7 +391,7 @@ export const testPickerOpenCloseLifeCycle: DescribeValueTestSuite { diff --git a/test/utils/pickers/describeValue/testShortcuts.tsx b/test/utils/pickers/describeValue/testShortcuts.tsx index 71bed9c937076..39d4bd37d1b23 100644 --- a/test/utils/pickers/describeValue/testShortcuts.tsx +++ b/test/utils/pickers/describeValue/testShortcuts.tsx @@ -1,10 +1,8 @@ import * as React from 'react'; -import { expect } from 'chai'; import { spy } from 'sinon'; import { expectPickerChangeHandlerValue } from 'test/utils/pickers'; import { fireEvent, screen } from '@mui/internal-test-utils'; import { DescribeValueTestSuite } from './describeValue.types'; -import { describeSkipIf } from '../../skipIf'; export const testShortcuts: DescribeValueTestSuite = (ElementToTest, options) => { const { @@ -17,7 +15,7 @@ export const testShortcuts: DescribeValueTestSuite = (ElementToTe ...pickerParams } = options; - describeSkipIf(componentFamily !== 'picker')('Picker shortcuts', () => { + describe.skipIf(componentFamily !== 'picker')('Picker shortcuts', () => { it('should call onClose, onChange and onAccept when picking a shortcut without explicit changeImportance', async () => { const onChange = spy(); const onAccept = spy(); diff --git a/test/utils/pickers/fields.tsx b/test/utils/pickers/fields.tsx index 4d1ba261ffdc0..cfdd99b27235c 100644 --- a/test/utils/pickers/fields.tsx +++ b/test/utils/pickers/fields.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { createTheme, ThemeProvider } from '@mui/material/styles'; import { createRenderer, screen, act, fireEvent } from '@mui/internal-test-utils'; import { FieldRef, FieldSectionType } from '@mui/x-date-pickers/models'; diff --git a/test/utils/pickers/viewHandlers.ts b/test/utils/pickers/viewHandlers.ts index 8c78a199e8cc3..f93cc7eeb8229 100644 --- a/test/utils/pickers/viewHandlers.ts +++ b/test/utils/pickers/viewHandlers.ts @@ -12,7 +12,7 @@ export const timeClockHandler: ViewHandler = { const hasMeridiem = adapter.is12HourCycleInCurrentLocale(); let valueInt; - let clockView; + let clockView: 'minutes' | '12hours' | '24hours'; if (view === 'hours') { valueInt = adapter.getHours(value); diff --git a/test/utils/scheduler/conformanceTests/className.tsx b/test/utils/scheduler/conformanceTests/className.tsx index 3809dde8d8e1d..d1e934a53eaf6 100644 --- a/test/utils/scheduler/conformanceTests/className.tsx +++ b/test/utils/scheduler/conformanceTests/className.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import type { ConformantComponentProps, SchedulerPrimitivesConformanceTestsOptions, diff --git a/test/utils/scheduler/conformanceTests/propForwarding.tsx b/test/utils/scheduler/conformanceTests/propForwarding.tsx index 6061e15e29fc9..9ae419b77f138 100644 --- a/test/utils/scheduler/conformanceTests/propForwarding.tsx +++ b/test/utils/scheduler/conformanceTests/propForwarding.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import { flushMicrotasks, randomStringValue } from '@mui/internal-test-utils'; import { throwMissingPropError } from './utils'; import type { diff --git a/test/utils/scheduler/conformanceTests/refForwarding.tsx b/test/utils/scheduler/conformanceTests/refForwarding.tsx index 6a890f2fe10b0..ded443e5c4400 100644 --- a/test/utils/scheduler/conformanceTests/refForwarding.tsx +++ b/test/utils/scheduler/conformanceTests/refForwarding.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { expect } from 'chai'; import type { ConformantComponentProps, SchedulerPrimitivesConformanceTestsOptions, diff --git a/test/utils/skipIf.ts b/test/utils/skipIf.ts index 36d64a4b61270..dea5c0218ca30 100644 --- a/test/utils/skipIf.ts +++ b/test/utils/skipIf.ts @@ -1,24 +1,3 @@ -// Shim for vitest describe.skipIf to be able to run mocha and vitest side-by-side -/** - * Skip a test suite if a condition is met. - * @param {boolean} condition - The condition to check. - * @returns {Function} The test suite function. - */ -export const describeSkipIf: (condition: boolean) => Mocha.PendingSuiteFunction = - (describe as any).skipIf ?? - function describeSkipIf(condition: boolean) { - return condition ? describe.skip : describe; - }; - -/** - * Skip a test if a condition is met. - * @param {boolean} condition - The condition to check. - * @returns {Function} The test function. - */ -export const testSkipIf: (condition: boolean) => Mocha.PendingTestFunction = ( - condition: boolean, -) => (condition ? it.skip : it); - export const isJSDOM = /jsdom/.test(window.navigator.userAgent); export const isOSX = /macintosh/i.test(window.navigator.userAgent); export const hasTouchSupport = diff --git a/test/utils/tree-view/describeTreeView/describeTreeView.tsx b/test/utils/tree-view/describeTreeView/describeTreeView.tsx index dc4c6c99a0430..cc52da2df4d1b 100644 --- a/test/utils/tree-view/describeTreeView/describeTreeView.tsx +++ b/test/utils/tree-view/describeTreeView/describeTreeView.tsx @@ -39,7 +39,7 @@ const innerDescribeTreeView = ); } - const cleanItem = (item: TreeViewBaseItem) => { + const cleanItem = (item: TreeViewBaseItem): { id: any; children?: any } => { if (item.children) { return { id: item.id, children: item.children.map(cleanItem) }; } diff --git a/test/utils/tsconfig.json b/test/utils/tsconfig.json new file mode 100644 index 0000000000000..a1d4cbdb61972 --- /dev/null +++ b/test/utils/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "types": [ + "@mui/internal-test-utils/initMatchers", + "@mui/material/themeCssVarsAugmentation", + "dayjs/plugin/timezone.d.ts", + "dayjs/plugin/utc.d.ts", + "vite/client", + "vitest/globals", + "moment-timezone" + ], + "skipLibCheck": true + } +}