@mui/internal-test-utils 2.0.13 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,12 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- const chai_1 = __importStar(require("chai"));
37
- chai_1.default.use((chaiAPI, utils) => {
38
- chai_1.default.Assertion.addMethod('toHaveFocus', async function elementHandleIsFocused() {
36
+ const chai = __importStar(require("chai"));
37
+ chai.use((chaiAPI, utils) => {
38
+ chai.Assertion.addMethod('toHaveFocus', async function elementHandleIsFocused() {
39
39
  const $elementOrHandle = utils.flag(this, 'object');
40
40
  if ($elementOrHandle == null) {
41
- throw new chai_1.AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
41
+ throw new chai.AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
42
42
  }
43
43
  const $element = typeof $elementOrHandle.then === 'function'
44
44
  ? await $elementOrHandle
@@ -53,10 +53,10 @@ chai_1.default.use((chaiAPI, utils) => {
53
53
  });
54
54
  this.assert(isFocused, `expected element to have focus`, `expected element to NOT have focus \n${stringifiedElement}`, stringifiedElement, stringifiedActiveElement);
55
55
  });
56
- chai_1.default.Assertion.addMethod('toHaveAttribute', async function elementHandleHasAttribute(attributeName, attributeValue) {
56
+ chai.Assertion.addMethod('toHaveAttribute', async function elementHandleHasAttribute(attributeName, attributeValue) {
57
57
  const $elementOrHandle = utils.flag(this, 'object');
58
58
  if ($elementOrHandle == null) {
59
- throw new chai_1.AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
59
+ throw new chai.AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
60
60
  }
61
61
  const $element = typeof $elementOrHandle.then === 'function'
62
62
  ? await $elementOrHandle
@@ -1 +1 @@
1
- {"version":3,"file":"initPlaywrightMatchers.js","sourceRoot":"","sources":["../src/initPlaywrightMatchers.ts"],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,CAAC;QAED,IAAI,OAAO;YACT,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC/B,CAAC;QAED,IAAI,OAAO;YACT,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC/B,CAAC;KACF;IACD,mBAAmB;IACnB,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@mui/internal-test-utils",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "author": "MUI Team",
5
5
  "description": "Utilities for MUI tests. This is an internal package not meant for general use.",
6
6
  "main": "./build/index.js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mui/material-ui.git",
10
+ "directory": "packages-internal/test-utils"
11
+ },
7
12
  "exports": {
8
13
  ".": "./build/index.js",
9
14
  "./createDescribe": "./build/createDescribe.js",
@@ -30,7 +35,7 @@
30
35
  "@babel/plugin-transform-modules-commonjs": "^7.27.1",
31
36
  "@babel/preset-typescript": "^7.27.1",
32
37
  "@babel/register": "^7.28.3",
33
- "@babel/runtime": "^7.28.3",
38
+ "@babel/runtime": "^7.28.4",
34
39
  "@emotion/cache": "^11.14.0",
35
40
  "@emotion/react": "^11.14.0",
36
41
  "@testing-library/dom": "^10.4.1",
@@ -39,27 +44,26 @@
39
44
  "chai-dom": "^1.12.1",
40
45
  "dom-accessibility-api": "^0.7.0",
41
46
  "format-util": "^1.0.5",
42
- "fs-extra": "^11.3.1",
43
47
  "jsdom": "^26.1.0",
44
48
  "lodash": "^4.17.21",
45
- "mocha": "^11.7.1",
49
+ "mocha": "^11.7.2",
46
50
  "prop-types": "^15.8.1",
47
51
  "sinon": "^21.0.0"
48
52
  },
49
53
  "devDependencies": {
50
- "@playwright/test": "^1.55.0",
54
+ "@playwright/test": "^1.55.1",
51
55
  "@types/chai": "^4.3.20",
52
56
  "@types/chai-dom": "^1.11.3",
53
57
  "@types/format-util": "^1.0.4",
54
58
  "@types/prop-types": "^15.7.15",
55
- "@types/react": "^19.1.11",
56
- "@types/react-dom": "^19.1.7",
59
+ "@types/react": "^19.1.13",
60
+ "@types/react-dom": "^19.1.9",
57
61
  "@types/sinon": "^17.0.4",
58
62
  "typescript": "^5.9.2"
59
63
  },
60
64
  "peerDependencies": {
61
65
  "@playwright/test": "^1.53.1",
62
- "chai": "^4.5.0 || ^5.0.0",
66
+ "chai": "^4.5.0 || ^5.0.0 || ^6.0.0",
63
67
  "react": "^18.0.0 || ^19.0.0",
64
68
  "react-dom": "^18.0.0 || ^19.0.0"
65
69
  },
@@ -1,6 +1,6 @@
1
1
  // File is not transpiled.
2
2
  const path = require('path');
3
- const fse = require('fs-extra');
3
+ const fs = require('node:fs');
4
4
 
5
5
  /**
6
6
  * @typedef {object} Browser
@@ -25,7 +25,7 @@ function KarmaReporterReactProfiler(karmaConfig) {
25
25
  `Expected karma config to contain reactProfilerReporter.outputDir of type 'string' but got type '${typeof outputDir}'.`,
26
26
  );
27
27
  }
28
- fse.ensureDirSync(outputDir);
28
+ fs.mkdirSync(outputDir, { recursive: true });
29
29
 
30
30
  /**
31
31
  * @param {Browser} browser
@@ -44,7 +44,7 @@ function KarmaReporterReactProfiler(karmaConfig) {
44
44
  this.onBrowserStart = (browser) => {
45
45
  allRenders.set(browser.id, {});
46
46
  // Create it on start to signal to users where the files will appear
47
- fse.ensureDirSync(path.join(outputDir, browser.name));
47
+ fs.mkdirSync(path.join(outputDir, browser.name), { recursive: true });
48
48
 
49
49
  browser.emitter.addListener('browser_info', handleBrowserInfo);
50
50
  };
@@ -67,10 +67,11 @@ function KarmaReporterReactProfiler(karmaConfig) {
67
67
  return;
68
68
  }
69
69
 
70
- fse.ensureDirSync(path.join(outputDir, browser.name));
71
- fse.writeJSONSync(path.join(outputDir, browser.name, `${Date.now()}.json`), browserRenders, {
72
- spaces: 2,
73
- });
70
+ fs.mkdirSync(path.join(outputDir, browser.name), { recursive: true });
71
+ fs.writeFileSync(
72
+ path.join(outputDir, browser.name, `${Date.now()}.json`),
73
+ JSON.stringify(browserRenders, null, 2),
74
+ );
74
75
  };
75
76
  }
76
77
 
@@ -0,0 +1,8 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import 'chai';
3
+ import type { AssertionError as RealAssertionError } from 'assertion-error';
4
+
5
+ declare module 'chai' {
6
+ // Looks like they forgot to export the AssertionError type in @types/chai
7
+ export const AssertionError: typeof RealAssertionError;
8
+ }
package/src/chaiPlugin.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { isInaccessible } from '@testing-library/dom';
2
2
  import { prettyDOM } from '@testing-library/react/pure';
3
- import type chaiType from 'chai';
4
- import { AssertionError } from 'chai';
3
+ import * as chai from 'chai';
5
4
  import { computeAccessibleDescription, computeAccessibleName } from 'dom-accessibility-api';
6
5
  import formatUtil from 'format-util';
7
- import _ from 'lodash';
6
+ // avoid loading whole lodash, it takes ~50ms to initialize
7
+ import kebabCase from 'lodash.kebabcase';
8
8
  import './chai.types';
9
9
 
10
10
  const isKarma = Boolean(process.env.KARMA);
11
11
 
12
12
  function isInJSDOM() {
13
- return /jsdom/.test(window.navigator.userAgent);
13
+ return window.navigator.userAgent.includes('jsdom');
14
14
  }
15
15
 
16
16
  // chai#utils.elToString that looks like stringified elements in testing-library
@@ -21,7 +21,7 @@ function elementToString(element: Element | null | undefined) {
21
21
  return String(element);
22
22
  }
23
23
 
24
- const chaiPlugin: Parameters<(typeof chaiType)['use']>[0] = (chaiAPI, utils) => {
24
+ const chaiPlugin: Parameters<typeof chai.use>[0] = (chaiAPI, utils) => {
25
25
  const blockElements = new Set([
26
26
  'html',
27
27
  'address',
@@ -202,7 +202,7 @@ const chaiPlugin: Parameters<(typeof chaiType)['use']>[0] = (chaiAPI, utils) =>
202
202
  // This is closer to actual CSS and required for getPropertyValue anyway.
203
203
  const expectedStyle: Record<string, string> = {};
204
204
  Object.keys(expectedStyleUnnormalized).forEach((cssProperty) => {
205
- const hyphenCasedPropertyName = _.kebabCase(cssProperty);
205
+ const hyphenCasedPropertyName = kebabCase(cssProperty);
206
206
  const isVendorPrefixed = /^(moz|ms|o|webkit)-/.test(hyphenCasedPropertyName);
207
207
  const propertyName = isVendorPrefixed
208
208
  ? `-${hyphenCasedPropertyName}`
@@ -279,7 +279,7 @@ const chaiPlugin: Parameters<(typeof chaiType)['use']>[0] = (chaiAPI, utils) =>
279
279
 
280
280
  const jsdomHint =
281
281
  'Styles in JSDOM e.g. from `test:unit` are often misleading since JSDOM does not implement the Cascade nor actual CSS property value computation. ' +
282
- 'If results differ between real browsers and JSDOM, skip the test in JSDOM e.g. `if (/jsdom/.test(window.navigator.userAgent)) this.skip();`';
282
+ 'If results differ between real browsers and JSDOM, skip the test in JSDOM e.g. `if (window.navigator.userAgent.includes("jsdom")) this.skip();`';
283
283
  const shorthandHint =
284
284
  'Browsers can compute shorthand properties differently. Prefer longhand properties e.g. `borderTopColor`, `borderRightColor` etc. instead of `border` or `border-color`.';
285
285
  const messageHint = `${jsdomHint}\n${shorthandHint}`;
@@ -316,7 +316,7 @@ const chaiPlugin: Parameters<(typeof chaiType)['use']>[0] = (chaiAPI, utils) =>
316
316
  const element = utils.flag(this, 'object') as HTMLElement;
317
317
  if (element?.nodeType !== 1) {
318
318
  // Same pre-condition for negated and unnegated assertion
319
- throw new AssertionError(`Expected an Element but got ${String(element)}`);
319
+ throw new chai.AssertionError(`Expected an Element but got ${String(element)}`);
320
320
  }
321
321
 
322
322
  assertMatchingStyles.call(this, element.style, expectedStyleUnnormalized, {
@@ -331,7 +331,7 @@ const chaiPlugin: Parameters<(typeof chaiType)['use']>[0] = (chaiAPI, utils) =>
331
331
  const element = utils.flag(this, 'object') as HTMLElement;
332
332
  if (element?.nodeType !== 1) {
333
333
  // Same pre-condition for negated and unnegated assertion
334
- throw new AssertionError(`Expected an Element but got ${String(element)}`);
334
+ throw new chai.AssertionError(`Expected an Element but got ${String(element)}`);
335
335
  }
336
336
  const computedStyle = element.ownerDocument.defaultView!.getComputedStyle(element);
337
337
 
@@ -774,7 +774,7 @@ function testThemeStyleOverrides(
774
774
  ) {
775
775
  describe('theme style overrides:', () => {
776
776
  it("respect theme's styleOverrides custom state", async function test(t = {}) {
777
- if (/jsdom/.test(window.navigator.userAgent)) {
777
+ if (window.navigator.userAgent.includes('jsdom')) {
778
778
  // @ts-ignore
779
779
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
780
780
  this?.skip?.() ?? t?.skip();
@@ -831,7 +831,7 @@ function testThemeStyleOverrides(
831
831
  });
832
832
 
833
833
  it("respect theme's styleOverrides slots", async function test(t = {}) {
834
- if (/jsdom/.test(window.navigator.userAgent)) {
834
+ if (window.navigator.userAgent.includes('jsdom')) {
835
835
  // @ts-ignore
836
836
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
837
837
  this?.skip?.() ?? t?.skip();
@@ -944,7 +944,7 @@ function testThemeStyleOverrides(
944
944
  });
945
945
 
946
946
  it('overrideStyles does not replace each other in slots', async function test(t = {}) {
947
- if (/jsdom/.test(window.navigator.userAgent)) {
947
+ if (window.navigator.userAgent.includes('jsdom')) {
948
948
  // @ts-ignore
949
949
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
950
950
  this?.skip?.() ?? t?.skip();
@@ -1027,7 +1027,7 @@ function testThemeVariants(
1027
1027
  ) {
1028
1028
  describe('theme variants:', () => {
1029
1029
  it("respect theme's variants", async function test(t = {}) {
1030
- if (/jsdom/.test(window.navigator.userAgent)) {
1030
+ if (window.navigator.userAgent.includes('jsdom')) {
1031
1031
  // @ts-ignore
1032
1032
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1033
1033
  this?.skip?.() ?? t?.skip();
@@ -1084,7 +1084,7 @@ function testThemeVariants(
1084
1084
  });
1085
1085
 
1086
1086
  it('supports custom variant', async function test(t = {}) {
1087
- if (/jsdom/.test(window.navigator.userAgent)) {
1087
+ if (window.navigator.userAgent.includes('jsdom')) {
1088
1088
  // @ts-ignore
1089
1089
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1090
1090
  this?.skip?.() ?? t?.skip();
@@ -1140,7 +1140,12 @@ function testThemeCustomPalette(
1140
1140
  describe('theme extended palette:', () => {
1141
1141
  it('should render without errors', function test(t = {}) {
1142
1142
  const { render, ThemeProvider, createTheme } = getOptions();
1143
- if (!/jsdom/.test(window.navigator.userAgent) || !render || !ThemeProvider || !createTheme) {
1143
+ if (
1144
+ !window.navigator.userAgent.includes('jsdom') ||
1145
+ !render ||
1146
+ !ThemeProvider ||
1147
+ !createTheme
1148
+ ) {
1144
1149
  // @ts-ignore
1145
1150
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1146
1151
  this?.skip?.() ?? t?.skip();
@@ -1,4 +1,4 @@
1
- import { configure, fireEvent, getConfig } from '@testing-library/react';
1
+ import { configure, fireEvent, getConfig } from '@testing-library/react/pure';
2
2
  import reactMajor from './reactMajor';
3
3
 
4
4
  const noWrapper = (callback: () => void) => callback();
@@ -3,7 +3,9 @@ import { act, fireEvent } from './createRenderer';
3
3
  export default function focusVisible(element: HTMLElement) {
4
4
  act(() => {
5
5
  element.blur();
6
- fireEvent.keyDown(document.body, { key: 'Tab' });
6
+ });
7
+ fireEvent.keyDown(document.body, { key: 'Tab' });
8
+ act(() => {
7
9
  element.focus();
8
10
  });
9
11
  }
@@ -1,4 +1,4 @@
1
- import chai from 'chai';
1
+ import * as chai from 'chai';
2
2
  import chaiDom from 'chai-dom';
3
3
  import './chai.types';
4
4
  import chaiPlugin from './chaiPlugin';
@@ -1,4 +1,4 @@
1
- import chai, { AssertionError } from 'chai';
1
+ import * as chai from 'chai';
2
2
  import * as DomTestingLibrary from '@testing-library/dom';
3
3
  import type { ElementHandle } from '@playwright/test';
4
4
 
@@ -33,7 +33,9 @@ chai.use((chaiAPI, utils) => {
33
33
  chai.Assertion.addMethod('toHaveFocus', async function elementHandleIsFocused() {
34
34
  const $elementOrHandle: ElementHandle | Promise<ElementHandle> = utils.flag(this, 'object');
35
35
  if ($elementOrHandle == null) {
36
- throw new AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
36
+ throw new chai.AssertionError(
37
+ `Expected an element handle but got ${String($elementOrHandle)}.`,
38
+ );
37
39
  }
38
40
  const $element =
39
41
  typeof ($elementOrHandle as Promise<any>).then === 'function'
@@ -66,7 +68,9 @@ chai.use((chaiAPI, utils) => {
66
68
  async function elementHandleHasAttribute(attributeName: string, attributeValue?: string) {
67
69
  const $elementOrHandle: ElementHandle | Promise<ElementHandle> = utils.flag(this, 'object');
68
70
  if ($elementOrHandle == null) {
69
- throw new AssertionError(`Expected an element handle but got ${String($elementOrHandle)}.`);
71
+ throw new chai.AssertionError(
72
+ `Expected an element handle but got ${String($elementOrHandle)}.`,
73
+ );
70
74
  }
71
75
  const $element =
72
76
  typeof ($elementOrHandle as Promise<any>).then === 'function'
@@ -23,7 +23,7 @@ testingLibrary.configure({
23
23
  (globalThis as any).IS_REACT_ACT_ENVIRONMENT = true;
24
24
 
25
25
  failOnConsole({
26
- silenceMessage: (message) => {
26
+ silenceMessage: (message: string) => {
27
27
  if (process.env.NODE_ENV === 'production') {
28
28
  // TODO: mock scheduler
29
29
  if (message.includes('act(...) is not supported in production builds of React')) {
@@ -10,7 +10,6 @@
10
10
  "composite": true,
11
11
  "tsBuildInfoFile": "./build/.tsbuildinfo",
12
12
  "target": "ES2020",
13
- "module": "commonjs",
14
13
  "types": ["node"],
15
14
  "allowJs": true
16
15
  }
package/tsconfig.json CHANGED
@@ -2,7 +2,8 @@
2
2
  "compilerOptions": {
3
3
  "lib": ["es2020", "dom"],
4
4
  "noEmit": true,
5
- "moduleResolution": "node",
5
+ "module": "nodenext",
6
+ "moduleResolution": "nodenext",
6
7
  "types": ["node", "mocha"],
7
8
  "strict": true,
8
9
  "esModuleInterop": true,