-
Notifications
You must be signed in to change notification settings - Fork 27
[code-infra] Adopt @mui/internal-test-utils
#927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Bundle size report
Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces the @mui/internal-test-utils package to the code-infra repository, consolidating testing utilities to enable faster iteration and development. The package provides a comprehensive suite of test utilities including renderers, matchers, conformance testing, and helper functions for React component testing.
Key Changes
- New test-utils package with complete TypeScript and Vitest configuration
- Custom chai matchers for accessibility, focus, and style assertions
- Conformance testing framework for component consistency
- React Testing Library wrapper with enhanced functionality
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/test-utils/package.json | Package definition with dependencies and exports for the new test utilities |
| packages/test-utils/tsconfig.json | TypeScript configuration for the test-utils package |
| packages/test-utils/tsconfig.build.json | Build-specific TypeScript configuration |
| packages/test-utils/vitest.config.mts | Vitest test configuration with jsdom environment setup |
| packages/test-utils/src/index.ts | Main entry point exporting all test utilities |
| packages/test-utils/src/setupVitest.ts | Vitest setup with console error/warning suppression |
| packages/test-utils/src/setupVitestBrowser.ts | Browser environment setup with Touch API polyfill |
| packages/test-utils/src/initMatchers.ts | Initializes chai matchers for tests |
| packages/test-utils/src/initMatchers.test.js | Test suite for custom error/warning matchers |
| packages/test-utils/src/initPlaywrightMatchers.ts | Playwright-specific matchers for browser testing |
| packages/test-utils/src/chaiPlugin.ts | Custom chai assertions for accessibility and styling |
| packages/test-utils/src/chai.types.ts | TypeScript type definitions for custom chai matchers |
| packages/test-utils/src/createRenderer.tsx | Enhanced React Testing Library renderer with emotion cache |
| packages/test-utils/src/createRenderer.test.jsx | Tests for the custom renderer functionality |
| packages/test-utils/src/createDescribe.ts | Utility for creating describe blocks with skip/only support |
| packages/test-utils/src/describeConformance.tsx | Comprehensive conformance testing framework for components |
| packages/test-utils/src/components.tsx | Test helper components (ErrorBoundary, RenderCounter) |
| packages/test-utils/src/focusVisible.ts | Focus management utilities for testing |
| packages/test-utils/src/flushMicrotasks.ts | Async utility for flushing microtasks |
| packages/test-utils/src/fireDiscreteEvent.ts | Discrete event firing utilities for React 17/18 compatibility |
| packages/test-utils/src/env.ts | Environment detection utilities |
| packages/code-infra/src/eslint/material-ui/config.mjs | ESLint configuration update to support .jsx extension |
Co-authored-by: Copilot <[email protected]> Signed-off-by: Jan Potoms <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Jan Potoms <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Jan Potoms <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Jan Potoms <[email protected]>
OK, so Intuitively, I would expect https://github.com/mui/base-ui to be where we can iterate the fastest with this logic, because it covers 80%+ of the test cases for this test utils package, and allows an instant deployment experience against those tests. So wouldn't it be the best place to host those internal modules? |
Makes it possible to iterate faster on this module, the goal is to thin it out and remove unnecessary wrapper APIs.
in this PR I also make emotion optional for
createRenderer