{"repo":"testing-library/jest-dom","free":true,"listed":false,"github":"https://github.com/testing-library/jest-dom","clone":"git clone https://github.com/testing-library/jest-dom.git","description":":owl: Custom jest matchers to test the state of the DOM","language":"JavaScript","stars":4595,"topics":["testing","dom","jest","jest-matchers","jsdom","javascript","custom-matcher","react-testing-library","dom-testing-library","testing-library"],"license":"MIT","category":"dev-tools","readme_excerpt":"jest-dom Custom jest matchers to test the state of the DOM --- [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] [![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] [![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] The problem You want to use [jest][] to write tests that assert various things about the state of a DOM. As part of that goal, you want to avoid all the repetitive patterns that arise in doing so. Checking for an element's attributes, its text content, its css classes, you name it. This solution The @testing-library/jest-dom library provides a set of custom jest matchers that you can use to extend jest. These will make your tests more declarative, clear to read and to maintain. Table of Contents - Installation - Usage - With @jest/globals - With Vitest - With TypeScript - With another Jest-compatible expect - Custom matchers - toBeDisabled - toBeEnabled - toBeEmptyDOMElement - toBeInTheDocument - toBeInvalid - toBeRequired - toBeValid - toBeVisible - toContainElement - toContainHTML - toHaveAccessibleDescription - toHaveAccessibleErrorMessage - toHaveAccessibleName - toHaveAttribute - toHaveClass - toHaveFocus - toHaveFormValues - toHaveStyle - toHaveTextContent - toHav","default_branch":null,"files":null,"tree":[],"storefront":"/r/testing-library","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/testing-library/jest-dom/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}