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 Mar 30, 2024 via pnpm

@testing-library/react 11.2.7

Simple and complete React DOM testing utilities that encourage good testing practices.
Package summary
Share
1
issue
1
high severity
meta
1
3
licenses
41
MIT
1
Apache-2.0
1
ISC
Package created
30 May 2019
Version published
14 May 2021
Maintainers
15
Total deps
43
Direct deps
4
License
MIT

Issues

1

1 high severity issue

high
via: @testing-library/dom@7.31.2
Collapse
Expand

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
41 Packages, Including:
@babel/code-frame@7.24.2
@babel/helper-validator-identifier@7.22.20
@babel/highlight@7.24.2
@babel/runtime-corejs3@7.24.1
@babel/runtime@7.24.1
@jest/types@26.6.2
@testing-library/dom@7.31.2
@testing-library/react@11.2.7
@types/aria-query@4.2.2
@types/istanbul-lib-coverage@2.0.6
@types/istanbul-lib-report@3.0.3
@types/istanbul-reports@3.0.4
@types/node@20.12.2
@types/yargs-parser@21.0.3
@types/yargs@15.0.19
ansi-regex@5.0.1
ansi-styles@3.2.1
ansi-styles@4.3.0
chalk@2.4.2
chalk@4.1.2
color-convert@1.9.3
color-convert@2.0.1
color-name@1.1.3
color-name@1.1.4
core-js-pure@3.36.1
dom-accessibility-api@0.5.16
escape-string-regexp@1.0.5
has-flag@3.0.0
has-flag@4.0.0
js-tokens@4.0.0
loose-envify@1.4.0
lz-string@1.5.0
pretty-format@26.6.2
react-dom@18.2.0
react-is@17.0.2
react@18.2.0
regenerator-runtime@0.14.1
scheduler@0.23.0
supports-color@5.5.0
supports-color@7.2.0
undici-types@5.26.5

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@4.2.2

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
picocolors@1.0.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

4
All Dependencies CSV
β“˜ This is a list of @testing-library/react 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@babel/runtime7.24.1256 kBMIT
prod
@testing-library/dom7.31.2596.8 kBMIT
prod
1
react-dom18.2.01.04 MBMIT
prod peer
react18.2.079.25 kBMIT
prod peer

Visualizations

Frequently Asked Questions

What does @testing-library/react do?

The @testing-library/react is a comprehensive set of testing utilities for React that encourages good testing practices. It provides light utility functions on top of react-dom and react-dom/test-utils, promoting better testing practices. This library is focused on making your tests resemble the way your software is used, supporting both React Hooks and Classes.

How do you use @testing-library/react?

To use @testing-library/react, you first need to install it as a devDependency in your project using npm or yarn. Installation can be done with the following shell commands:

  • With npm:
npm install --save-dev @testing-library/react
  • With yarn:
yarn add --dev @testing-library/react

In a simple use case, here is how to use it:

import { render, screen } from '@testing-library/react';
import MyComponent from './MyComponent';

test('renders learn react link', () => {
  render(<MyComponent />);
  const linkElement = screen.getByText(/learn react/i);
  expect(linkElement).toBeInTheDocument();
});

This testing pattern uses tools from the library to render a React component, query the rendered output, and make assertions based on the queried output.

For complex usage and more examples, refer to the documentation or the project's GitHub repository.

Where are the @testing-library/react docs?

The official @testing-library/react documentation can be found here. The docs give you an in-depth understanding of how to use the library, different utilities it provides, and examples of how to use them. You can also find various useful examples of testing different libraries in react-testing-library-examples codesandbox.