Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

testing-library/dom-testing-library

octopus

Simple and complete DOM testing utilities that encourage good testingpractices.

Read the docs |Edit the docs


Build StatusCode CoverageversiondownloadsMIT LicenseAll ContributorsPRs WelcomeCode of ConductDiscord

Watch on GitHubStar on GitHubTweet

TestingJavaScript.com Learn the smart, efficient way to test any JavaScript application.

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 componentsand rather focus on making your tests give you the confidence for which they areintended. As part of this, you want your testbase to be maintainable in the longrun so refactors of your components (changes to implementation but notfunctionality) don't break your tests and slow you and your team down.

This Solution

TheDOM Testing Library is a very light-weight solution for testing DOM nodes(whether simulated withJSDOM as provided bydefault withJest or in the browser). The main utilities it provides involvequerying the DOM for nodes in a way that's similar to how the user findselements on the page. In this way, the library helps ensure your tests give youconfidence in your UI code. TheDOM Testing Library's primary guidingprinciple is:

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

Installation

This module is distributed vianpm which is bundled withnode andshould be installed as one of your project'sdevDependencies:

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

Docs

Documentation

Read the docs (and discover framework and tool-specific implementations) attesting-library.com

Guiding Principles

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

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

Utilities are included in this project based on the following guidingprinciples:

  1. If it relates to rendering components, it deals with DOM nodes rather thancomponent instances, nor should it encourage dealing with componentinstances.
  2. It should be generally useful for testing the application components in theway the user would use it. Weare making some trade-offs here becausewe're using a computer and often a simulated browser environment, but ingeneral, utilities should encourage tests that use the components the waythey'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 prettylight-weight, simple, and understandable.

Contributors

Thanks goes to these people (emoji key):

Kent C. Dodds
Kent C. Dodds

💻📖🚇⚠️
Greg Bergé
Greg Bergé

🤔
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

💻⚠️
Alex Young
Alex Young

💻
Paul Armstrong
Paul Armstrong

💻⚠️
Tamás Szabó
Tamás Szabó

💻⚠️
Dylan Piercey
Dylan Piercey

💻⚠️
Michael Lasky
Michael Lasky

💻⚠️📖
Sebastian Silbermann
Sebastian Silbermann

💻⚠️📖🚇👀
Dylan Vann
Dylan Vann

💻
Adrià Fontcuberta
Adrià Fontcuberta

💻⚠️📖
Thomas Lombart
Thomas Lombart

💻
Sam Horton
Sam Horton

💻⚠️
Andrew Hill
Andrew Hill

💻
Jan Amann
Jan Amann

💻⚠️
Brais Piñeiro
Brais Piñeiro

💻⚠️
Dominykas Blyžė
Dominykas Blyžė

💻⚠️
Olzhas Askar
Olzhas Askar

💻⚠️📖
Max Belsky
Max Belsky

💻⚠️
Michael Mantel
Michael Mantel

⚠️
Tom Nagle
Tom Nagle

💻
Westbrook Johnson
Westbrook Johnson

💻
Mohammad Aziz
Mohammad Aziz

💻⚠️
seetdev
seetdev

⚠️💻
Xavier Garcia Buils
Xavier Garcia Buils

💻⚠️
aw-davidson
aw-davidson

💻⚠️
Michaël De Boey
Michaël De Boey

💻
Minh Nguyen
Minh Nguyen

💻
Egill Sveinbjörnsson
Egill Sveinbjörnsson

💻
Pavel Pustovalov
Pavel Pustovalov

📖
Adam Palaniuk
Adam Palaniuk

💻⚠️
Yama-Tomo
Yama-Tomo

💻⚠️
Aaron Pettengill
Aaron Pettengill

💻⚠️
Kate W. Boyd
Kate W. Boyd

💻
Rahul Suryakanth
Rahul Suryakanth

💻⚠️
Jamie
Jamie

💻⚠️
Nicolas Stepien
Nicolas Stepien

💻
Ken Powers
Ken Powers

💻
Michał Zdunek
Michał Zdunek

💻
Ali Nasserzadeh
Ali Nasserzadeh

💻
Darek Kay
Darek Kay

📖💻⚠️
Lukas
Lukas

💻⚠️
Tom Crockett
Tom Crockett

💻⚠️
Kevin Brewer
Kevin Brewer

💻⚠️
Ben Monro
Ben Monro

💻🤔⚠️📖
Stephan Meijer
Stephan Meijer

🤔💻⚠️
João Forja
João Forja

💻⚠️
Nick McCurdy
Nick McCurdy

📖💻⚠️👀🚇
Caleb Meredith
Caleb Meredith

💻
Marco Moretti
Marco Moretti

💻⚠️👀
Travis Jefferson
Travis Jefferson

💻⚠️
Maciej Jastrzebski
Maciej Jastrzebski

🐛
Geoff Harcourt
Geoff Harcourt

💻
Josh Goldberg
Josh Goldberg

💻⚠️
Ken Gregory
Ken Gregory

💻⚠️
Jacob Paris
Jacob Paris

💻⚠️
keiya sasaki
keiya sasaki

📖
Idan Entin
Idan Entin

💻⚠️
Deniz Susman
Deniz Susman

💻
Bianca Del Carretto
Bianca Del Carretto

⚠️💻
Josh Lalonde
Josh Lalonde

💻⚠️
Ioannis Papadopoulos
Ioannis Papadopoulos

💻⚠️
Maxwell Newlands
Maxwell Newlands

💻⚠️
Jared Luxenberg
Jared Luxenberg

💻⚠️
snizhana
snizhana

💻⚠️
Michael van Engelshoven
Michael van Engelshoven

👀
Asher Tuggle
Asher Tuggle

🐛
Winter LaMon
Winter LaMon

💻⚠️
Victor Cordova
Victor Cordova

💻⚠️
slowselfip
slowselfip

🐛
Dmitry Semigradsky
Dmitry Semigradsky

💻
Adam
Adam

💻⚠️
balavishnuvj
balavishnuvj

💻
Chris Colborne
Chris Colborne

💻
Romain Trotard
Romain Trotard

💻
Thomas Marshall
Thomas Marshall

💻⚠️
johnjessewood
johnjessewood

🐛💻
Ari Perkkiö
Ari Perkkiö

🐛💻📖
Nathan Force
Nathan Force

💻
Philipp Fritsche
Philipp Fritsche

💻
Renato Alencar
Renato Alencar

💻⚠️
Simen Bekkhus
Simen Bekkhus

🐛
Dan Abramov
Dan Abramov

🐛👀
Matan Borenkraout
Matan Borenkraout

💻
simcha90
simcha90

💻
Amit Miran
Amit Miran

🚇
Dominik Lesch
Dominik Lesch

📖
Gareth Jones
Gareth Jones

💻⚠️
Rayat Rahman
Rayat Rahman

💻
Nik Savchenko
Nik Savchenko

💻
Kevin Fleischman
Kevin Fleischman

💻⚠️
Beth Hitch
Beth Hitch

💻
Jack Laurence
Jack Laurence

💻
SantoJambit
SantoJambit

💻
Yashu Mittal
Yashu Mittal

📖
Ian VanSchooten
Ian VanSchooten

💻
Vanya Prokopovich
Vanya Prokopovich

🐛
James Nail
James Nail

🐛
Rob Caldecott
Rob Caldecott

🐛
Dennis273
Dennis273

💻
Jackson Hardaker
Jackson Hardaker

⚠️
Robin Drexler
Robin Drexler

💻
Omer Dolev
Omer Dolev

💻
Lirlev48
Lirlev48

💻
Tarnay Kálmán
Tarnay Kálmán

💻
Than Hutchins
Than Hutchins

💻
Raphaël LEMIEUX
Raphaël LEMIEUX

💻
Arthur Lauck Vilas Boas
Arthur Lauck Vilas Boas

📖
Daniel Acuña
Daniel Acuña

💻
Craig Morten
Craig Morten

💻💬
Naor Peled
Naor Peled

💻
Julien Wajsberg
Julien Wajsberg

💻🐛
Kevin BON
Kevin BON

💻🐛
sieem
sieem

💻

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

LICENSE

MIT

About

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

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp