Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 17, 2024 via pnpm

@testing-library/jest-dom 6.1.3

Custom jest matchers to test the state of the DOM
Package summary
Share
0
issues
2
licenses
18
MIT
1
Apache-2.0
Package created
8 Jul 2019
Version published
6 Sep 2023
Maintainers
15
Total deps
19
Direct deps
8
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
18 Packages, Including:
@adobe/css-tools@4.3.3
@babel/runtime@7.23.9
@testing-library/jest-dom@6.1.3
ansi-styles@4.3.0
chalk@3.0.0
color-convert@2.0.1
color-name@1.1.4
css.escape@1.5.1
dequal@2.0.3
dom-accessibility-api@0.5.16
has-flag@4.0.0
indent-string@4.0.0
lodash@4.17.21
min-indent@1.0.1
redent@3.0.0
regenerator-runtime@0.14.1
strip-indent@3.0.0
supports-color@7.2.0

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
aria-query@5.3.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

8
All Dependencies CSV
β“˜ This is a list of @testing-library/jest-dom 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@adobe/css-tools4.3.335.41 kBMIT
prod
@babel/runtime7.23.953.23 kBMIT
prod
aria-query5.3.01 BApache-2.0
prod
chalk3.0.010.67 kBMIT
prod
css.escape1.5.12.89 kBMIT
prod
dom-accessibility-api0.5.1657.01 kBMIT
prod
lodash4.17.21311.49 kBMIT
prod
redent3.0.01.77 kBMIT
prod

Visualizations

Frequently Asked Questions

What does @testing-library/jest-dom do?

The @testing-library/jest-dom library provides a set of custom jest matchers that are handy for testing the DOM state. Rather than manipulating and checking the state of the DOM directly, it allows you to perform various checks on the DOM API in a much more declarative and readable way.

For instance, you could verify whether an element has a specific attribute, whether an element is visible, or if an element contains another element as a descendant. It also lets you check an element's text content or style, whether it has focus or not, and much more. These abilities make it an essential tool for enhancing productivity and maintainability in testing JavaScript applications.

How do you use @testing-library/jest-dom?

To utilize the @testing-library/jest-dom, first, add it to your project's devDependencies using either npm or yarn:

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

or

yarn add --dev @testing-library/jest-dom

Then, import @testing-library/jest-dom in your test setup file, and it's ready to use:

import '@testing-library/jest-dom'

For instance, if you want to check if an element is in the document, you can do it like this:

expect(getByTestId(document.documentElement, 'html-element')).toBeInTheDocument()

Or if you want to check whether an element has a specific attribute, that can be done like this:

const button = getByTestId('ok-button')
expect(button).toHaveAttribute('disabled')
expect(button).toHaveAttribute('type', 'submit')

Many more matchers are available. They allow you to assert various things about the state of the DOM, avoiding all the repetitive patterns that arise in doing so.

Where are the @testing-library/jest-dom docs?

For detailed documentation, list of all available matchers, and further usage examples, refer to the GitHub repository of @testing-library/jest-dom. The repository provides a comprehensive reference to every function available in the library and offers additional context and insights that are beneficial when adding jest-dom to your testing workflow.