Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-testing-library

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-testing-library

Simple and complete DOM testing utilities that encourage good testing practices.

  • 4.1.1
  • npm
  • Socket score

Version published
Weekly downloads
42K
increased by18.54%
Maintainers
1
Weekly downloads
 
Created
Source

dom-testing-library

octopus

Simple and complete DOM testing utilities that encourage good testing practices.

Read the docs | Edit the docs


Build Status Code Coverage version downloads MIT License

All Contributors PRs Welcome Code of Conduct

Watch on GitHub Star on GitHub Tweet

Table of Contents

The Problem

You want to write maintainable tests for your Web UI. As a part of this goal, you want your tests to avoid including implementation details of your components and rather focus on making your tests give you the confidence for which they are intended. As part of this, you want your testbase to be maintainable in the long run so refactors of your components (changes to implementation but not functionality) don't break your tests and slow you and your team down.

This Solution

The dom-testing-library is a very light-weight solution for testing DOM nodes (whether simulated with JSDOM as provided by default with Jest or in the browser). The main utilities it provides involve querying the DOM for nodes in a way that's similar to how the user finds elements on the page. In this way, the library helps ensure your tests give you confidence in your UI code. The dom-testing-library's primary guiding principle is:

The more your tests resemble the way your software is used, the more confidence they can give you.

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies:

npm install --save-dev dom-testing-library

Docs

Implementations

This library was not built to be used on its own. The original implementation of these utilities was in the react-testing-library.

Implementations include:

Other Solutions

Guiding Principles

The more your tests resemble the way your software is used, the more confidence they can give you.

We try to only expose methods and utilities that encourage you to write tests that closely resemble how your web pages are used.

Utilities are included in this project based on the following guiding principles:

  1. If it relates to rendering components, it deals with DOM nodes rather than component instances, nor should it encourage dealing with component instances.
  2. It should be generally useful for testing the application components in the way the user would use it. We are making some trade-offs here because we're using a computer and often a simulated browser environment, but in general, utilities should encourage tests that use the components the way they're intended to be used.
  3. Utility implementations and APIs should be simple and flexible.

At the end of the day, what we want is for this library to be pretty light-weight, simple, and understandable.

Contributors

Thanks goes to these people (emoji key):

Kent C. Dodds
Kent C. Dodds

💻 📖 🚇 ⚠️
Ryan Castner
Ryan Castner

📖
Daniel Sandiego
Daniel Sandiego

💻
Paweł Mikołajczyk
Paweł Mikołajczyk

💻
Alejandro Ñáñez Ortiz
Alejandro Ñáñez Ortiz

📖
Matt Parrish
Matt Parrish

🐛 💻 📖 ⚠️
Justin Hall
Justin Hall

📦
Anto Aravinth
Anto Aravinth

💻 ⚠️ 📖
Jonah Moses
Jonah Moses

📖
Łukasz Gandecki
Łukasz Gandecki

💻 ⚠️ 📖
Ivan Babak
Ivan Babak

🐛 🤔 💻 📖
Jesse Day
Jesse Day

💻
Ernesto García
Ernesto García

💬 💻 📖
Josef Maxx Blake
Josef Maxx Blake

💻 📖 ⚠️
Alex Cook
Alex Cook

📖 💡 👀
Daniel Cook
Daniel Cook

💻 📖 ⚠️
Thomas Chia
Thomas Chia

🐛 💻
Tim Deschryver
Tim Deschryver

💻 ⚠️
Alex Krolick
Alex Krolick

💻
Maddi Joyce
Maddi Joyce

💻
Peter Kamps
Peter Kamps

🐛 💻 ⚠️
Jonathan Stoye
Jonathan Stoye

📖
Sanghyeon Lee
Sanghyeon Lee

💡
Justice Mba
Justice Mba

💻 📖 🤔
Wayne Crouch
Wayne Crouch

💻
Ben Elliott
Ben Elliott

💻
Ruben Costa
Ruben Costa

💻
Robert Smith
Robert Smith

🐛 🤔 📖
dadamssg
dadamssg

💻
Neil Kistner
Neil Kistner

💻
Ben Chauvette
Ben Chauvette

💻
Jeff Baumgardt
Jeff Baumgardt

💻 📖
Matan Kushner
Matan Kushner

💻 📖 🤔 ⚠️
Alex Wendte
Alex Wendte

💻 📖 ⚠️
Tamas Fodor
Tamas Fodor

📖
Benjamin Eckardt
Benjamin Eckardt

💻
Ryan Campbell
Ryan Campbell

📖
Taylor Briggs
Taylor Briggs

⚠️
John Gozde
John Gozde

💻
C. T. Lin
C. T. Lin

📖
Terrence Wong
Terrence Wong

💻
Soo Jae Hwang
Soo Jae Hwang

💻
Royston Shufflebotham
Royston Shufflebotham

🐛 💻 📖 ⚠️
Vadim Brodsky
Vadim Brodsky

💻
Eunjae Lee
Eunjae Lee

💻
David Peter
David Peter

💻
Shy Alter
Shy Alter

💻 📖
Łukasz Makuch
Łukasz Makuch

📦
Tyler Haas
Tyler Haas

💻 ⚠️
Vesa Laakso
Vesa Laakso

💻 ⚠️
Tulsi Sapkota
Tulsi Sapkota

💻
Tiago Nunes
Tiago Nunes

💻 ⚠️
JaxCavalera
JaxCavalera

💻 👀
bopfer
bopfer

⚠️
Jan Pfitzner
Jan Pfitzner

💻
David
David

💻
Diego Hernandez
Diego Hernandez

💻 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

MIT

Keywords

FAQs

Package last updated on 23 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc