enzymejs/enzyme
47.2
Weak · 1 October 2026
9.4k
lines of production code
JavaScript
primary language
2
measurements over time
What this system is
This system is a JavaScript testing library for React components, structured as a Lerna monorepo to manage core functionality and version-specific adapters. It provides utilities for mounting, shallow rendering, and traversing React component trees, with dedicated packages supporting React versions from 0.13 through 16.3. The architecture decouples core logic from specific React implementations via an adapter pattern, ensuring compatibility with legacy and modern React features such as hooks, context, and portals.
How it got here
2015–2017 — Enzyme v3 monorepo rewrite
17 changes.
The project underwent a major architectural overhaul, restructuring into a Lerna monorepo and rewriting the core API to support an adapter-based design. This period focused on implementing comprehensive support for multiple React versions through dedicated adapter packages and establishing a robust, version-agnostic test suite to ensure compatibility.
2018–2020 — React 16.3 and Hooks support
4 changes.
This period focused on extending Enzyme's compatibility with React 16.3 by introducing a dedicated adapter that supports new features like Context API, Portals, and Forward Refs. The work also involved adding comprehensive test suites for React Hooks and component lifecycle methods to ensure robust rendering and interaction capabilities across these updates.
Features
Add Mocha example project for Enzyme
Introduces a new example package demonstrating how to set up and run tests with Enzyme using the Mocha test runner. The package includes a sample React component, corresponding test specifications, and configuration files for Babel, ESLint, and code coverage, providing a reference implementation for users adopting this testing stack.
packages/enzyme-example-mocha · high confidence
Add React 0.13 adapter support
Enzyme now supports testing components built with React 0.13 via the new \enzyme-adapter-react-13\ package. This adapter enables shallow rendering, mounting, and DOM simulation for legacy React versions, including specific handling for context modes and lifecycle methods like \componentDidUpdate\ to ensure compatibility with React 0.13's internal APIs.
packages/enzyme-adapter-react-13/src · high confidence
Add React 14 adapter with legacy context and lifecycle support
Introduced a new \enzyme-adapter-react-14\ package that enables Enzyme to work with React 14. The adapter configures \legacyContextMode\ to 'parent' and enables \prevContext\ in \componentDidUpdate\ to match React 14's behavior, while also supporting the \getChildContext\ lifecycle. It utilizes the \react-is\ package for type checking and integrates with the shared \enzyme-adapter-utils\ for rendering and tree traversal.
packages/enzyme-adapter-react-14/src · high confidence
Add React 15.4 adapter with lifecycle and context support
The \enzyme-adapter-react-15.4\ package is introduced, providing a new adapter for testing React 15.4 components. This adapter configures specific lifecycle behaviors, including enabling \prevContext\ support in \componentDidUpdate\ and setting \legacyContextMode\ to 'parent' to align with React 15's context handling. It also supports the \getChildContext\ lifecycle method and integrates with the \react-is\ library for type checking, ensuring compatibility with the specific internal structure of React 15.4 instances.
packages/enzyme-adapter-react-15.4/src · high confidence
Add React 16.3 adapter
Introduces a new Enzyme adapter for React 16.3, enabling users to test components using this specific React version. The adapter implementation includes support for React 16.3 features such as Context API (providers and consumers), Portals, and Forward Refs, ensuring compatibility with the new internal fiber structure.
packages/enzyme-adapter-react-16.1/src, packages/enzyme-adapter-react-16.2/src, packages/enzyme-adapter-react-16.3/src · high confidence
Introduce React 16 adapter with support for modern React features
The \enzyme-adapter-react-16\ package is introduced, providing a new adapter to enable Enzyme to work with React 16. This adapter adds support for React 16-specific features including Suspense, Lazy loading, Portals, Context (Provider/Consumer), ForwardRef, Memo components, and the Profiler API. It also implements proper handling for React's Fiber architecture, including detection of fiber tags and a slow-path fiber reflection utility to correctly identify current nodes in the tree. The adapter ensures compatibility with React 16.4+ features like pointer events and auxClick, while maintaining backward compatibility with earlier React 16 versions where possible.
packages/enzyme-adapter-react-16/src · high confidence
Introduce enzyme-adapter-react-helper for automatic adapter selection and React version compatibility
This change adds a new helper package that simplifies Enzyme configuration by automatically detecting the installed React version and selecting the appropriate adapter, eliminating the need for manual adapter setup. It also provides a \safeSFC\ utility that wraps stateless functional components to handle React 0.14's limitation where returning \null\ is not supported, ensuring consistent behavior across older React versions.
packages/enzyme-adapter-react-helper/src · high confidence
Introduce enzyme-adapter-utils package with core mounting and rendering utilities
This change extracts and introduces the \enzyme-adapter-utils\ package, providing shared utilities for Enzyme adapters. It adds a \RootFinder\ component to manage root references and wrapper components (\createMountWrapper\, \createRenderWrapper\) that handle context propagation and mounting logic. The \Utils\ module exposes helper functions for mapping native event names to React props (including support for pointer, animation, and auxclick events), flattening iterable children, and determining node display names. Additionally, it provides a \wrapWithSimpleWrapper\ function to wrap elements for consistent testing behavior across React versions.
packages/enzyme-adapter-utils/src · high confidence
Introduce shallow equality comparison utility
Added a new \shallowEqual\ function to the \enzyme-shallow-equal\ package that compares two objects for shallow equality. The implementation checks if the objects are the same reference, validates that both are non-null objects, ensures they have the same number of keys, and then verifies that all corresponding keys and values are strictly equal using \Object.is\. This utility is adapted from React's internal shallow equality logic and relies on the \hasown\ package for safe property checking.
packages/enzyme-shallow-equal/src · high confidence
Architecture
Repository restructured into a Lerna monorepo with modernized build and test tooling
The project has been reorganized from a single package into a Lerna monorepo (using independent versioning) containing multiple packages under \packages/\. This change introduces a modernized development environment: Babel is configured with the \airbnb\ preset and specific plugins (\transform-replace-object-assign\, \add-module-exports\) to support ESM syntax and polyfills, while ESLint is updated to use \@babel/eslint-parser\ and the Airbnb config. Test coverage reporting has switched from \coveralls\ to \nyc\ (configured via \.nycrc\), and the test environment setup script (\env.js\) now uses \child\_process.spawn\ for streaming output. Additionally, the repository now includes a GitBook-based documentation structure (\SUMMARY.md\, \book.json\) and a comprehensive \CHANGELOG.md\.
(repo-wide) · high confidence
Behavioural changes
Enzyme package structure and build configuration update
The Enzyme package has been restructured to support modern build processes and improved developer experience. The package now includes a \.babelrc\ configuration that enables source maps and uses the \add-module-exports\ plugin to ensure compatibility with both CommonJS and ES module consumers. Entry points for core APIs (ReactWrapper, ShallowWrapper, mount, render, shallow, withDom) are simplified to re-export from the \build/\ directory. Additionally, the \withDom\ entry point now explicitly handles jsdom polyfills and provides clearer error messaging if jsdom is missing. Linting is standardized via \.eslintrc\ extending Airbnb config with \@babel/eslint-parser\, and ignore files are symlinked to the root for consistency.
packages/enzyme · high confidence
Enzyme v3: Complete API rewrite with adapter-based architecture
Enzyme has been rewritten from the ground up for version 3, introducing a new adapter-based architecture that decouples core logic from specific React versions. This change replaces the previous implementation with new \ReactWrapper\ and \ShallowWrapper\ classes, a base \EnzymeAdapter\ class for integrations, and a new \RSTTraversal\ module for tree manipulation. The new API supports modern React features including Fragments, Context API, and Hooks, while introducing new methods like \hostNodes\, \simulateError\, and \getWrappingComponent\. The \mount\ and \shallow\ functions now accept options for lifecycle control, and the \debug\ output has been enhanced with verbose mode and better handling of non-renderable values.
packages/enzyme/src · high confidence
React 15 adapter now supports legacy context and prevContext in componentDidUpdate
The Enzyme adapter for React 15 has been updated to correctly handle legacy context modes and lifecycle arguments. Specifically, it now sets \legacyContextMode\ to 'parent' to align with React 15's context behavior, and configures the \componentDidUpdate\ lifecycle to receive the \prevContext\ argument, fixing issues where this argument was previously missing during updates.
packages/enzyme-adapter-react-15/src · high confidence
Test coverage
Added Mocha test setup for jsdom environment; Added comprehensive test suite for Enzyme wrapper methods; Added shared lifecycle tests for React components; Added shared test suite for React Hooks; Configure Mocha test environment with DOM adapter setup; Initial test suite for Enzyme core and adapters; Test suite helper infrastructure for multi-version React compatibility.
Dependencies
Enzyme and Adapters Update Dependencies
The Enzyme testing library and its React adapters (for versions 13, 14, 15, 15.4, 16, 16.1, 16.2, and 16.3) have updated their dependencies. Key updates include \enzyme-adapter-utils\ to v1.14.2, \react-is\ to ^17.0.2 (or ^16.13.1 for React 16.3 adapter), and \prop-types\ to ^15.8.1. The main \enzyme\ package now depends on \cheerio\ =1.0.0-rc.3 and includes shims like \object.assign\, \object.values\, and \array.prototype.flat\. Dev dependencies such as \eslint\ (^8.56.0), \@babel/\*\ packages (^7.28.x), and \mocha\ (^3.5.3) have also been updated.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 51 → 47 (-4.2)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 46 → 46 (+0.0)
- Architecture 66 → 72 (+5.4)
- Maturity 57 → 57 (+0.0)
- Readiness 50 → 38 (-12.4)
- Security 73 → 77 (+4.5)
Resolved (2)
- Documentation: contradicts the code (docs/guides/migration-from-2-to-3.md)
- Documentation: contradicts the code (docs/guides/mocha.md)
New (3)
- Low cohesion: ReactWrapper (LCOM4 7) (packages/enzyme/src/ReactWrapper.js)
- Low cohesion: ShallowWrapper (LCOM4 4) (packages/enzyme/src/ShallowWrapper.js)
- Scanner failed to run — not a clean result
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
enzymejs/enzyme was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 61e1b47c4bdc4509b2ac286c0d3ae3df172d26f0 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.