7
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Jest】【React Testing Library】Property 'toBeInTheDocument' does not exist on type 'JestMatchers<HTMLElement>'.解消法【Next.js】

Last updated at Posted at 2022-06-21

こちらのコメントをご確認ください。

状況

JestとReact Testing LibraryでNext.jsのテストを実行していたところ、以下のようにエラーが発生しました。

スクリーンショット 2022-06-22 午前8.01.23.png

解消法

以下のコマンドを実行することで解消しました。

$ yarn add -D  @types/testing-library__jest-dom

スクリーンショット 2022-06-22 午前8.18.26.png

参考

7
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?