react-testing-library VS Enzyme

Compare react-testing-library vs Enzyme and see what are their differences.

react-testing-library

🐐 Simple and complete React DOM testing utilities that encourage good testing practices. (by testing-library)
Our great sponsors
  • Sonar - Write Clean JavaScript Code. Always.
  • Scout APM - Truly a developer’s best friend
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Zigi - Close all those tabs. Zigi will handle your updates.
react-testing-library Enzyme
12 26
17,208 19,951
1.2% 0.0%
5.8 1.0
about 1 month ago 9 days ago
JavaScript JavaScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

react-testing-library

Posts with mentions or reviews of react-testing-library. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-05-10.

Enzyme

Posts with mentions or reviews of Enzyme. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-10-17.
  • Difference Between JEST and Enzyme?
    2 projects | dev.to | 17 Oct 2022
    Enzyme offers two types of API for shallow rendering and full rendering. Both are preferred for different test scenarios and functionalities.
  • Testing with Jest and React Testing Library
    6 projects | dev.to | 18 Sep 2022
    At Visa, I was writing unit tests for a Next.js project using components designed with Chakra UI. That's where React Testing Library came in handy. Unlike other solutions like Enzyme, I did not have to worry about the application snapshot but could instead focus on each UI element, its expected behaviour and the data it would render upon user interactions.
  • Superset: Testing and Enzyme to RTL conversion
    4 projects | dev.to | 31 May 2022
    Superset uses Jest and React Testing Library (RTL) to write unit and integration tests. In the past we used Enzyme, but now that we're currently converting all of our class components to functional components, Enzyme cannot support our testing needs. Since RTL is better for testing functional components, we're converting all of our test files to RTL. This can be quite a learning curve - I've gone through a lot of the process so I'd like to share what I've learned so far.
  • What would you consider to be a must for a modern 2022 dev stack?
    6 projects | reddit.com/r/ExperiencedDevs | 24 May 2022
    react testing library instead of enzyme for testing react UIs. I'll never go back.
  • What I Learned About Unit Testing Working at Volvo Group
    2 projects | dev.to | 14 Mar 2022
    I won't go into any more details there. Instead, I want to turn back to testing UI components again, that's the kind of unit testing I claimed to be useless in many cases. In details, we will discuss the concepts of shallow and mounting tests with Enzyme, and also interactional unit testing with Testing Library. Testing Library can be used with many libraries, including React.
    2 projects | dev.to | 14 Mar 2022
    Regarding the differences between Enzyme and React Testing Library, one can see at npm trends that Testing Library is more used nowadays. Meanwhile Enzyme is slowly dying since it isn't being maintained and lacks unofficial support for React 17.
  • Enzyme is dead. Now what?
    5 projects | dev.to | 20 Dec 2021
    React 17 Release Candidate came out. Shortly after, an issue has been raised in Enzyme repository to add support for React 17. Immediately after, @layershifter has opened a PR adding an official enzyme-adapter-react-17.
  • Understanding and implementing Cypress snapshot testing
    7 projects | dev.to | 7 Dec 2021
    Frontend code changes frequently and, every so often, existing UIs break as a result. To combat breaking code changes, well-managed codebases contain a plethora of unit and integration tests. Testing libraries such as Enzyme and React Testing Library provide tools to check whether a DOM node is rendered with the correct properties, styles, and children.
  • React 101: The Basics
    12 projects | dev.to | 30 Nov 2021
    Along with React, Facebook developed a tool for testing JavaScript called Jest. When used by itself, Jest is primary good for testing logic. It doesn't handle any sort of DOM rendering or snapshot testing, so another library is needed for that. The two most commonly used tools for DOM testing are Enzyme and React Testing Library. They both do pretty much the same thing, so it's really just a matter of preference. For end-to-end testing, the most commonly used library is Cypress.
  • Redux Testing: Hard-Earned Lessons Learned
    2 projects | dev.to | 23 Nov 2021
    The next utility that you'll need is a way to render your components with state and context. For my tests I'm usually using React Testing Library, but the same approach works fine if you're using enzyme.

What are some alternatives?

When comparing react-testing-library and Enzyme you can also consider the following projects:

react-beautiful-dnd - Beautiful and accessible drag and drop for lists with React

Tailwind CSS - A utility-first CSS framework for rapid UI development.

Sinon.JS - Test spies, stubs and mocks for JavaScript.

jest - Delightful JavaScript Testing.

WebdriverIO - Next-gen browser and mobile automation test framework for Node.js

react-hook-form - 📋 React Hooks for form state management and validation (Web + React Native)

jsdom - A JavaScript implementation of various web standards, for use with Node.js [Moved to: https://github.com/jsdom/jsdom]

Jooks (Jest ❤ + Hooks 🤘🏻) - Testing hooks with Jest

ui-harness - Create, isolate and test modular UI components in React.

react-unit - Lightweight unit test library for ReactJS

chai - BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.