Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/testing-library/dom-testing-library
๐ Simple and complete DOM testing utilities that encourage good testing practices.
https://github.com/testing-library/dom-testing-library
javascript testing
Last synced: 5 days ago
JSON representation
๐ Simple and complete DOM testing utilities that encourage good testing practices.
- Host: GitHub
- URL: https://github.com/testing-library/dom-testing-library
- Owner: testing-library
- License: mit
- Created: 2018-04-06T13:08:11.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-10T13:49:33.000Z (7 months ago)
- Last Synced: 2024-04-12T17:14:31.946Z (7 months ago)
- Topics: javascript, testing
- Language: JavaScript
- Homepage: https://testing-library.com/dom
- Size: 1.67 MB
- Stars: 3,227
- Watchers: 33
- Forks: 454
- Open Issues: 91
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome - dom-testing-library - ๐ Simple and complete DOM testing utilities that encourage good testing practices. (JavaScript)
- awesome-list - dom-testing-library - library | 2633 | (JavaScript)
README
DOM Testing Library
Simple and complete DOM testing utilities that encourage good testing
practices.[**Read the docs**](https://testing-library.com/dom) |
[Edit the docs](https://github.com/testing-library/testing-library-docs)
[![Build Status][build-badge]][build]
[![Code Coverage][coverage-badge]][coverage]
[![version][version-badge]][package]
[![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]
[![All Contributors][all-contributors-badge]](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Code of Conduct][coc-badge]][coc]
[![Discord][discord-badge]][discord][![Watch on GitHub][github-watch-badge]][github-watch]
[![Star on GitHub][github-star-badge]][github-star]
[![Tweet][twitter-badge]][twitter]## Table of Contents
- [The Problem](#the-problem)
- [This Solution](#this-solution)
- [Installation](#installation)
- [Documentation](#documentation)
- [Guiding Principles](#guiding-principles)
- [Contributors](#contributors)
- [LICENSE](#license)## 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`](https://github.com/jsdom/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.][guiding-principle]## Installation
This module is distributed via [npm][npm] which is bundled with [node][node] and
should be installed as one of your project's `devDependencies`:```
npm install --save-dev @testing-library/dom
```> [**Docs**](https://testing-library.com/docs/install)
## Documentation
Read the docs (and discover framework and tool-specific implementations) at
[testing-library.com](https://testing-library.com/dom)## Guiding Principles
> [The more your tests resemble the way your software is used, the more
> confidence they can give you.][guiding-principle]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][emojis]):
Kent C. Dodds
๐ป ๐ ๐ โ ๏ธ
Greg Bergรฉ
๐ค
Ryan Castner
๐
Daniel Sandiego
๐ป
Paweล Mikoลajczyk
๐ป
Alejandro รรกรฑez Ortiz
๐
Matt Parrish
๐ ๐ป ๐ โ ๏ธ
Justin Hall
๐ฆ
Anto Aravinth
๐ป โ ๏ธ ๐
Jonah Moses
๐
ลukasz Gandecki
๐ป โ ๏ธ ๐
Ivan Babak
๐ ๐ค ๐ป ๐
Jesse Day
๐ป
Ernesto Garcรญa
๐ฌ ๐ป ๐
Josef Maxx Blake
๐ป ๐ โ ๏ธ
Alex Cook
๐ ๐ก ๐
Daniel Cook
๐ป ๐ โ ๏ธ
Thomas Chia
๐ ๐ป
Tim Deschryver
๐ป โ ๏ธ ๐
Alex Krolick
๐ป
Maddi Joyce
๐ป
Peter Kamps
๐ ๐ป โ ๏ธ
Jonathan Stoye
๐ ๐ป
Sanghyeon Lee
๐ก
Justice Mba
๐ป ๐ ๐ค
Wayne Crouch
๐ป
Ben Elliott
๐ป
Ruben Costa
๐ป
Robert Smith
๐ ๐ค ๐
dadamssg
๐ป
Neil Kistner
๐ป โ ๏ธ
Ben Chauvette
๐ป
Jeff Baumgardt
๐ป ๐
Matan Kushner
๐ป ๐ ๐ค โ ๏ธ
Alex Wendte
๐ป ๐ โ ๏ธ
Tamas Fodor
๐
Benjamin Eckardt
๐ป
Ryan Campbell
๐
Taylor Briggs
โ ๏ธ
John Gozde
๐ป
C. T. Lin
๐
Terrence Wong
๐ป
Soo Jae Hwang
๐ป
Royston Shufflebotham
๐ ๐ป ๐ โ ๏ธ
Vadim Brodsky
๐ป
Eunjae Lee
๐ป
David Peter
๐ป
Shy Alter
๐ป ๐
ลukasz Makuch
๐ฆ
Tyler Haas
๐ป โ ๏ธ
Vesa Laakso
๐ป โ ๏ธ
Tulsi Sapkota
๐ป
Tiago Nunes
๐ป โ ๏ธ
JaxCavalera
๐ป ๐
bopfer
โ ๏ธ
Jan Pfitzner
๐ป
David
๐ป
Diego Hernandez
๐ป โ ๏ธ
Alex Young
๐ป
Paul Armstrong
๐ป โ ๏ธ
Tamรกs Szabรณ
๐ป โ ๏ธ
Dylan Piercey
๐ป โ ๏ธ
Michael Lasky
๐ป โ ๏ธ ๐
Sebastian Silbermann
๐ป โ ๏ธ ๐ ๐ ๐
Dylan Vann
๐ป
Adriร Fontcuberta
๐ป โ ๏ธ ๐
Thomas Lombart
๐ป
Sam Horton
๐ป โ ๏ธ
Andrew Hill
๐ป
Jan Amann
๐ป โ ๏ธ
Brais Piรฑeiro
๐ป โ ๏ธ
Dominykas Blyลพฤ
๐ป โ ๏ธ
Olzhas Askar
๐ป โ ๏ธ ๐
Max Belsky
๐ป โ ๏ธ
Michael Mantel
โ ๏ธ
Tom Nagle
๐ป
Westbrook Johnson
๐ป
Mohammad Aziz
๐ป โ ๏ธ
seetdev
โ ๏ธ ๐ป
Xavier Garcia Buils
๐ป โ ๏ธ
aw-davidson
๐ป โ ๏ธ
Michaรซl De Boey
๐ป
Minh Nguyen
๐ป
Egill Sveinbjรถrnsson
๐ป
Pavel Pustovalov
๐
Adam Palaniuk
๐ป โ ๏ธ
Yama-Tomo
๐ป โ ๏ธ
Aaron Pettengill
๐ป โ ๏ธ
Kate W. Boyd
๐ป
Rahul Suryakanth
๐ป โ ๏ธ
Jamie
๐ป โ ๏ธ
Nicolas Stepien
๐ป
Ken Powers
๐ป
Michaล Zdunek
๐ป
Ali Nasserzadeh
๐ป
Darek Kay
๐ ๐ป โ ๏ธ
Lukas
๐ป โ ๏ธ
Tom Crockett
๐ป โ ๏ธ
Kevin Brewer
๐ป โ ๏ธ
Ben Monro
๐ป ๐ค โ ๏ธ ๐
Stephan Meijer
๐ค ๐ป โ ๏ธ
Joรฃo Forja
๐ป โ ๏ธ
Nick McCurdy
๐ ๐ป โ ๏ธ ๐ ๐
Caleb Meredith
๐ป
Marco Moretti
๐ป โ ๏ธ ๐
Travis Jefferson
๐ป โ ๏ธ
Maciej Jastrzebski
๐
Geoff Harcourt
๐ป
Josh Goldberg
๐ป โ ๏ธ
Ken Gregory
๐ป โ ๏ธ
Jacob Paris
๐ป โ ๏ธ
keiya sasaki
๐
Idan Entin
๐ป โ ๏ธ
Deniz Susman
๐ป
Bianca Del Carretto
โ ๏ธ ๐ป
Josh Lalonde
๐ป โ ๏ธ
Ioannis Papadopoulos
๐ป โ ๏ธ
Maxwell Newlands
๐ป โ ๏ธ
Jared Luxenberg
๐ป โ ๏ธ
snizhana
๐ป โ ๏ธ
Michael van Engelshoven
๐
Asher Tuggle
๐
Winter LaMon
๐ป โ ๏ธ
Victor Cordova
๐ป โ ๏ธ
slowselfip
๐
Dmitry Semigradsky
๐ป
Adam
๐ป โ ๏ธ
balavishnuvj
๐ป
Chris Colborne
๐ป
Romain Trotard
๐ป
Thomas Marshall
๐ป โ ๏ธ
johnjessewood
๐ ๐ป
Ari Perkkiรถ
๐ ๐ป ๐
Nathan Force
๐ป
Philipp Fritsche
๐ป
Renato Alencar
๐ป โ ๏ธ
Simen Bekkhus
๐
Dan Abramov
๐ ๐
Matan Borenkraout
๐ป
simcha90
๐ป
Amit Miran
๐
Dominik Lesch
๐
Gareth Jones
๐ป โ ๏ธ
Rayat Rahman
๐ป
Nik Savchenko
๐ป
Kevin Fleischman
๐ป โ ๏ธ
Beth Hitch
๐ป
Jack Laurence
๐ป
SantoJambit
๐ป
Yashu Mittal
๐
Ian VanSchooten
๐ป
Vanya Prokopovich
๐
James Nail
๐
Rob Caldecott
๐
Dennis273
๐ป
Jackson Hardaker
โ ๏ธ
Robin Drexler
๐ป
Omer Dolev
๐ป
Lirlev48
๐ป
Tarnay Kรกlmรกn
๐ป
Than Hutchins
๐ป
Raphaรซl LEMIEUX
๐ป
Arthur Lauck Vilas Boas
๐
Daniel Acuรฑa
๐ป
Craig Morten
๐ป ๐ฌ
Naor Peled
๐ป
Julien Wajsberg
๐ป ๐
Kevin BON
๐ป ๐
sieem
๐ป
This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!## LICENSE
[MIT](LICENSE)
[npm]: https://www.npmjs.com/
[node]: https://nodejs.org
[build-badge]: https://img.shields.io/github/workflow/status/testing-library/dom-testing-library/validate?logo=github&style=flat-square
[build]: https://github.com/testing-library/dom-testing-library/actions?query=workflow%3Avalidate
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/dom-testing-library.svg?style=flat-square
[coverage]: https://codecov.io/github/testing-library/dom-testing-library
[version-badge]: https://img.shields.io/npm/v/@testing-library/dom.svg?style=flat-square
[package]: https://www.npmjs.com/package/@testing-library/dom
[downloads-badge]: https://img.shields.io/npm/dm/@testing-library/dom.svg?style=flat-square
[npmtrends]: http://www.npmtrends.com/@testing-library/dom
[license-badge]: https://img.shields.io/npm/l/@testing-library/dom.svg?style=flat-square
[license]: https://github.com/testing-library/dom-testing-library/blob/main/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/testing-library/dom-testing-library/blob/main/CODE_OF_CONDUCT.md
[github-watch-badge]: https://img.shields.io/github/watchers/testing-library/dom-testing-library.svg?style=social
[github-watch]: https://github.com/testing-library/dom-testing-library/watchers
[github-star-badge]: https://img.shields.io/github/stars/testing-library/dom-testing-library.svg?style=social
[github-star]: https://github.com/testing-library/dom-testing-library/stargazers
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20dom-testing-library%20by%20%40testing-library%20https%3A%2F%2Fgithub.com%2Ftesting-library%2Fdom-testing-library%20%F0%9F%91%8D
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/dom-testing-library.svg?style=social
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
[all-contributors-badge]: https://img.shields.io/github/all-contributors/testing-library/dom-testing-library?color=orange&style=flat-square
[set-immediate]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setImmediate
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
[jest]: https://facebook.github.io/jest
[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
[discord]: https://discord.gg/testing-library