Open
Description
Enzyme is not compatible with React 18, so we need to phase it out.
Preferred approach is to migrate to react-testing-library
. In some cases we may use a replacement shallow
function #1653, but only when absolutely necessary, it's better to move away from snapshot testing.
- https://testing-library.com/docs/react-testing-library/migrate-from-enzyme
- https://medium.com/zipyai/migrating-from-enzyme-to-react-testing-library-b1fb607d81ab
For examples of this being partially done, see merged PRs in this ticket below (e.g. #1659 #1653 #1643).
The scope of this is sizeable, so the recommendation is to limit the changes to specific modules, a couple test files at a time.
Current enzyme references (July 4 2025):
$ grep -rl 'import.*enzyme' packages/jaeger-ui/src
packages/jaeger-ui/src/components/Monitor/ServicesView/index.test.js
packages/jaeger-ui/src/components/QualityMetrics/index.test.js
packages/jaeger-ui/src/components/TraceDiff/TraceDiffHeader/TraceDiffHeader.test.js
packages/jaeger-ui/src/components/TraceDiff/TraceDiff.test.js
packages/jaeger-ui/src/components/TracePage/TraceSpanView/index.test.js
packages/jaeger-ui/src/components/TracePage/index.test.js
packages/jaeger-ui/src/components/TracePage/TracePageHeader/SpanGraph/ViewingLayer.test.js
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/VirtualizedTraceView.test.js
packages/jaeger-ui/src/components/SearchTracePage/SearchResults/index.test.js
packages/jaeger-ui/src/components/SearchTracePage/index.test.js
packages/jaeger-ui/src/components/SearchTracePage/SearchForm.test.js
$ grep -rl 'import.*enzyme' packages/jaeger-ui/src | wc -l
11