@testing-library/jest-dom version: 6.1.4
node version: 18.17.1
jest version: 29.7.0
npm version: 10.2.0
Other dependencies:

Relevant code or config:
import { render, screen } from "@testing-library/react";
import Home from "@/app/page";
it("should have Docs text", () => {
render(<Home />);
const myElement = screen.getByText("Docs");
expect(myElement).toBeInTheDocument();
});
What you did:
I was following a Next.js Testing tutorial by Dave Gray to learn more about React Testing. I followed the tutorial until the 17-minute mark where the error occurred.
What happened:
This is the error:

Reproduction:
The steps from the beginning until the 17th-minute mark of the tutorial will give the error.
Problem description:
Property 'toBeInTheDocument' does not exist on type 'JestMatchers'. It seems that it has something to do either with TypeScript, or the Nextjs 14, or with the latest release of testing-library/jest-dom
Suggested solution:
The only solution, which seems temporary, is to roll back to an older version like 5.16.5 or 5.17. This solves the problem.
@testing-library/jest-domversion: 6.1.4nodeversion: 18.17.1jestversion: 29.7.0npmversion: 10.2.0Other dependencies:
Relevant code or config:
What you did:
I was following a Next.js Testing tutorial by Dave Gray to learn more about React Testing. I followed the tutorial until the 17-minute mark where the error occurred.
What happened:
This is the error:

Reproduction:
The steps from the beginning until the 17th-minute mark of the tutorial will give the error.
Problem description:
Property 'toBeInTheDocument' does not exist on type 'JestMatchers'. It seems that it has something to do either with TypeScript, or the Nextjs 14, or with the latest release of testing-library/jest-dom
Suggested solution:
The only solution, which seems temporary, is to roll back to an older version like 5.16.5 or 5.17. This solves the problem.