test(deps): make suite pass on React 19 / MUI 9 / chai 6#56
Merged
leecalcote merged 3 commits intomasterfrom May 4, 2026
Merged
test(deps): make suite pass on React 19 / MUI 9 / chai 6#56leecalcote merged 3 commits intomasterfrom
leecalcote merged 3 commits intomasterfrom
Conversation
The dep upgrade left the test stack split between two React eras: enzyme +
react-shallow-renderer + the cfaester adapter were built for the React 17/18
internals, while React 19 ships a different shared-internals shape, removed
findDOMNode and Simulate, and freezes elements with a fiber back-reference
that breaks circular-graph assertions.
Reconstruct the legacy surface from inside the test setup, migrate the two
components whose APIs broke, and externalize runtime deps in rollup so the
bundle stops warning about subpath imports it shouldn't be inlining.
- test/setup-mocha-env.js: stub `__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`,
route React.use* through the shallow renderer's dispatcher, polyfill
findDOMNode by walking the fiber tree, rebuild Simulate as native event
dispatch (with input-tracker reset and checkbox-via-click handling), and
skip Object.freeze for React elements so `_owner` can be cleared at
creation time.
- src/components/TablePagination.js: migrate `backIconButtonProps`/`nextIconButtonProps`/`SelectProps`
to MUI v9's `slotProps.actions.{previousButton,nextButton}` / `slotProps.select`.
- src/components/TableToolbar.js: replace the dropped `<ReactToPrint>` /
`<PrintContextConsumer>` pair with a `useReactToPrint` hook wrapper.
- rollup.config.js: derive externals from package.json so peerDeps and
`@babel/runtime-corejs3/*` subpaths don't trigger "Unresolved dependencies".
- package.json: pin react-is to ^19.2.5 via overrides so the adapter's
isElement check recognizes React 19's `react.transitional.element` symbol.
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the repository to keep the existing Mocha + Enzyme test suite and build tooling working after upgrading to React 19, MUI v9, and Chai 6. This primarily does so by restoring legacy React test surfaces expected by the Enzyme React 18 adapter, and by adjusting a couple of component integrations for the newer MUI / react-to-print APIs.
Changes:
- Extend
test/setup-mocha-env.jswith React 19 compatibility shims (internals stub, hook dispatch routing,Simulate, andfindDOMNodepolyfills) and adjust jsdom globals for Chai 6. - Update
TableToolbarprinting implementation to useuseReactToPrintinstead of the removedReactToPrint/PrintContextConsumercomponents. - Update
TablePaginationto MUI v9slotPropsand adjust Rollup externals + npm overrides (react-is).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/setup-mocha-env.js |
Adds React 19/Chai 6 shims for Enzyme + shallow rendering and DOM event simulation. |
src/components/TableToolbar.js |
Migrates printing to useReactToPrint hook via a small wrapper component. |
src/components/TablePagination.js |
Migrates MUI TablePagination props to the v9 slotProps API. |
rollup.config.js |
Externalizes dependencies/peerDependencies (including subpath imports) to remove unresolved-dep warnings. |
package.json |
Adds an npm overrides pin for react-is to align React 19 element symbol handling. |
package-lock.json |
Lockfile updates reflecting dependency/override resolution changes. |
- findDOMNode: walk the BFS queue with an index pointer instead of array shift so traversal stays O(n) on larger fiber trees. - Simulate: map doubleClick -> dblclick (the actual DOM type) and route it through MouseEvent so onDoubleClick handlers fire. Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
Member
Author
|
@copilot please re-review the latest changes. |
Agent-Logs-Url: https://github.com/layer5io/mui-datatables/sessions/b0c2f601-a18d-4cc1-a2e8-72245263a539 Co-authored-by: leecalcote <7570704+leecalcote@users.noreply.github.com>
Copilot stopped work on behalf of
leecalcote due to an error
May 4, 2026 03:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIREDstub, hook-call → shallow-renderer dispatcher routing, fiber-walkingfindDOMNode, native-event-basedSimulate(with input value-tracker reset + checkbox-via-click), and anObject.freezeskip for React elements so we can null_ownerat creation.TablePaginationto MUI v9'sslotProps.actions.{previousButton,nextButton}/slotProps.select, andTableToolbarfrom the dropped<ReactToPrint>/<PrintContextConsumer>pair to auseReactToPrinthook wrapper.react-isto ^19.2.5 so the adapter's element check recognizes React 19'sreact.transitional.elementsymbol, and externalize runtime deps inrollup.config.jsso peerDeps and@babel/runtime-corejs3/*subpaths stop tripping rollup's "Unresolved dependencies" warning.Result:
npm test→ 234 passing, 0 failing.rollup -c→ no unresolved-dependency warnings.Test plan
npm test— full mocha suite passes (234 tests)npx rollup -c— clean build, no "Unresolved dependencies" warning