whatisgithub

What is enzyme?

gaearon/enzyme — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2018-08-24

6JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

In one sentence

Enzyme is a testing toolkit for React that lets you render components, simulate clicks and other user actions, and check that everything works as expected.

Mindmap

mindmap
  root((repo))
    What it does
      Test React components
      Simulate user actions
      Inspect rendered output
    Tech stack
      JavaScript
      React
      jQuery style API
    Rendering modes
      Shallow rendering
      Full DOM rendering
      Static rendering
    Use cases
      Unit test components
      Test forms
      Works with Jest Mocha
    Audience
      React developers
      QA engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Render a single React component in isolation and check it displays correctly

USE CASE 2

Simulate a button click and verify the right callback function fires

USE CASE 3

Mount a full form and confirm input changes update the submitted data

USE CASE 4

Add reliable component tests to an existing React app without new testing infrastructure

What is it built with?

JavaScriptReact

How does it compare?

gaearon/enzymearthurmoorgan/driftatom/etch-list-view
Stars666
LanguageJavaScriptJavaScriptJavaScript
Last pushed2018-08-242020-04-28
MaintenanceDormantDormant
Setup difficultyeasymoderatemoderate
Complexity2/52/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

So what is it?

Enzyme is a testing toolkit that makes it easier to write tests for React components. When you build a React application, you want to verify that your components render correctly and respond to user interactions the way you expect. Enzyme provides a straightforward way to inspect what your components produce and simulate user actions like clicks, without needing to understand a lot of testing infrastructure. The library gives you three main ways to test. The first is "shallow rendering," which tests a component in isolation by looking at only the component itself and ignoring any child components it contains, useful for unit testing a single piece. The second is "full DOM rendering," which actually builds out the complete component tree and lets you test how everything works together, including lifecycle methods like componentDidMount that run when components load. The third is "static rendering," which just converts a component to plain HTML so you can check its text and structure. All three approaches use a simple, intuitive API inspired by jQuery, so you can find components by tag name or CSS class, check their properties, and trigger events like clicks. Enzyme is unopinionated, meaning it plays nicely with whatever testing framework you already use, whether that's Mocha, Jest, Jasmine, or others. A React developer writing unit tests for a button component might use Enzyme to render the button, simulate a click, and assert that a callback function was called the expected number of times. A team testing a complex form might use it to mount the entire form, change input values, and verify that the data gets submitted correctly. The tool essentially removes boilerplate and guesswork from React testing so developers can focus on writing clear, maintainable test code.

Copy-paste prompts

Prompt 1
Show me how to write an Enzyme shallow-render test for a React button component that checks a click handler fires.
Prompt 2
Help me set up Enzyme with Jest to test a React form component's full DOM rendering.
Prompt 3
Explain the difference between Enzyme's shallow, full DOM, and static rendering and when to use each.
Prompt 4
Write an Enzyme test that simulates changing an input value and asserts the form state updates correctly.

Frequently asked questions

What is enzyme?

Enzyme is a testing toolkit for React that lets you render components, simulate clicks and other user actions, and check that everything works as expected.

What language is enzyme written in?

Mainly JavaScript. The stack also includes JavaScript, React.

Is enzyme actively maintained?

Dormant — no commits in 2+ years (last push 2018-08-24).

How hard is enzyme to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is enzyme for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.