Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chai
  • Loading branch information
Janpot committed Nov 19, 2025
commit 5c1ae7535b331e294f45a7cadfc1bb33e3eedc2a
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"@mui/internal-test-utils": "workspace:^",
"@playwright/test": "^1.56.1",
"@types/autosuggest-highlight": "^3.2.3",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/chance": "^1.1.7",
"@types/css-mediaquery": "^0.1.4",
"@types/fg-loadcss": "^3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages-internal/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@babel/register": "^7.28.3",
"@types/babel__core": "^7.20.5",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/doctrine": "^0.0.9",
"@types/node": "^20.19.25",
"@types/react": "^19.2.4",
Expand Down
3 changes: 2 additions & 1 deletion packages-internal/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"assertion-error": "^2.0.1",
"chai-dom": "^1.12.1",
"dom-accessibility-api": "^0.7.0",
"es-toolkit": "^1.41.0",
Expand All @@ -59,7 +60,7 @@
},
"devDependencies": {
"@playwright/test": "^1.56.1",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/chai-dom": "^1.11.3",
"@types/format-util": "^1.0.4",
"@types/jsdom": "^21.1.7",
Expand Down
8 changes: 0 additions & 8 deletions packages-internal/test-utils/src/chai-augmentation.d.ts

This file was deleted.

5 changes: 3 additions & 2 deletions packages-internal/test-utils/src/chaiPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as chai from 'chai';
import { computeAccessibleDescription, computeAccessibleName } from 'dom-accessibility-api';
import formatUtil from 'format-util';
import { kebabCase } from 'es-toolkit/string';
import { AssertionError } from 'assertion-error';
import './chai.types';

const isKarma = Boolean(process.env.KARMA);
Expand Down Expand Up @@ -315,7 +316,7 @@ const chaiPlugin: Parameters<typeof chai.use>[0] = (chaiAPI, utils) => {
const element = utils.flag(this, 'object') as HTMLElement;
if (element?.nodeType !== 1) {
// Same pre-condition for negated and unnegated assertion
throw new chai.AssertionError(`Expected an Element but got ${String(element)}`);
throw new AssertionError(`Expected an Element but got ${String(element)}`);
}

assertMatchingStyles.call(this, element.style, expectedStyleUnnormalized, {
Expand All @@ -330,7 +331,7 @@ const chaiPlugin: Parameters<typeof chai.use>[0] = (chaiAPI, utils) => {
const element = utils.flag(this, 'object') as HTMLElement;
if (element?.nodeType !== 1) {
// Same pre-condition for negated and unnegated assertion
throw new chai.AssertionError(`Expected an Element but got ${String(element)}`);
throw new AssertionError(`Expected an Element but got ${String(element)}`);
}
const computedStyle = element.ownerDocument.defaultView!.getComputedStyle(element);

Expand Down
9 changes: 3 additions & 6 deletions packages-internal/test-utils/src/initPlaywrightMatchers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as chai from 'chai';
import * as DomTestingLibrary from '@testing-library/dom';
import type { ElementHandle } from '@playwright/test';
import { AssertionError } from 'assertion-error';

// https://stackoverflow.com/a/46755166/3406963
declare global {
Expand Down Expand Up @@ -33,9 +34,7 @@ chai.use((chaiAPI, utils) => {
chai.Assertion.addMethod('toHaveFocus', async function elementHandleIsFocused() {
const $elementOrHandle: ElementHandle | Promise<ElementHandle> = utils.flag(this, 'object');
if ($elementOrHandle == null) {
throw new chai.AssertionError(
`Expected an element handle but got ${String($elementOrHandle)}.`,
);
throw new AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
}
const $element =
typeof ($elementOrHandle as Promise<any>).then === 'function'
Expand Down Expand Up @@ -68,9 +67,7 @@ chai.use((chaiAPI, utils) => {
async function elementHandleHasAttribute(attributeName: string, attributeValue?: string) {
const $elementOrHandle: ElementHandle | Promise<ElementHandle> = utils.flag(this, 'object');
if ($elementOrHandle == null) {
throw new chai.AssertionError(
`Expected an element handle but got ${String($elementOrHandle)}.`,
);
throw new AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
}
const $element =
typeof ($elementOrHandle as Promise<any>).then === 'function'
Expand Down
3 changes: 1 addition & 2 deletions packages-internal/test-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react",
// https://github.com/vitest-dev/vitest/issues/4688
// TODO: Remove after fully migrated chai to vitest
// Remove when https://github.com/thomasbrodusch/vitest-fail-on-console/issues/160 is resolved
"skipLibCheck": true
},
"include": ["./src/**/*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"es-toolkit": "^1.41.0"
},
"devDependencies": {
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.25",
"@types/sinon": "^17.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@types/babel__core": "^7.20.5",
"@types/babel__traverse": "^7.28.0",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/doctrine": "^0.0.9",
"@types/mdast": "4.0.4",
"@types/mocha": "^10.0.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"prismjs": "^1.30.0"
},
"devDependencies": {
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"chai": "^6.0.1"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"devDependencies": {
"@material-ui/core": "^4.12.4",
"@mui/material-v5": "npm:@mui/material@5.18.0",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/jscodeshift": "0.12.0",
"chai": "^6.0.1"
},
Expand Down
1 change: 1 addition & 0 deletions packages/mui-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"devDependencies": {
"@mui/icons-material": "workspace:*",
"@mui/material": "workspace:*",
"@types/chai": "^5.2.2",
"@types/gtag.js": "^0.0.20",
"@types/node": "^20.19.25",
"@types/prop-types": "^15.7.15",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-envinfo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"envinfo": "^7.20.0"
},
"devDependencies": {
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"chai": "^6.0.1"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-icons-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@mui/icons-material": "workspace:*",
"@mui/internal-waterfall": "workspace:^",
"@mui/material": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/react": "^19.2.4",
"chai": "^6.0.1",
"chalk": "^5.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-joy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@mui/internal-test-utils": "workspace:^",
"@mui/material": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/prop-types": "^15.7.15",
"@types/react": "^19.2.4",
"@types/react-dom": "^19.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@mui/internal-test-utils": "workspace:^",
"@mui/material": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/prop-types": "^15.7.15",
"@types/react": "^19.2.4",
"@types/react-dom": "^19.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@mui/internal-test-utils": "workspace:^",
"@testing-library/dom": "^10.4.1",
"@testing-library/user-event": "^14.6.1",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/prop-types": "^15.7.15",
"@types/react": "^19.2.4",
"@types/react-dom": "^19.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-private-theming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"devDependencies": {
"@mui/internal-test-utils": "workspace:^",
"@mui/types": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/react": "^19.2.4",
"chai": "^6.0.1",
"react": "^19.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-styled-engine-sc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"devDependencies": {
"@mui/internal-test-utils": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/react": "^19.2.4",
"chai": "^6.0.1",
"react": "^19.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-styled-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@emotion/styled": "^11.14.1",
"@mui/internal-test-utils": "workspace:^",
"@mui/styled-engine": "workspace:*",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/react": "^19.2.4",
"chai": "^6.0.1",
"react": "^19.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-stylis-plugin-rtl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@mui/internal-test-utils": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.25",
"@types/sinon": "^17.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@emotion/styled": "^11.14.1",
"@mui/internal-test-utils": "workspace:^",
"@mui/system": "workspace:*",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/prop-types": "^15.7.15",
"@types/react": "^19.2.4",
"@types/sinon": "^17.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@mui/internal-test-utils": "workspace:^",
"@mui/types": "workspace:^",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.2",
"@types/mocha": "^10.0.10",
"@types/node": "^20.19.25",
"@types/react": "^19.2.4",
Expand Down
Loading
Loading