Property 'toHaveTextContent' does not exist on type 'JestMatchers<any>' 1

Property ‘toHaveTextContent’ does not exist on type ‘JestMatchers

$ yarn add @testing-library/jest-dom

import { render } from "@testing-library/react"
import "@testing-library/jest-dom/extend-expect" 

Here is what the above code is Doing:
1. Importing the render function from the @testing-library/react package.
2. Importing the @testing-library/jest-dom package.
3. Importing the @testing-library/jest-dom/extend-expect package.

The render function is used to render a React component.
The @testing-library/jest-dom package provides a set of custom jest matchers that you can use to extend jest.
The @testing-library/jest-dom/extend-expect package adds some useful assertions to jest.

Similar Posts