0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Next.js】react-testing-libraryでexpect(...).toBeInTheDocument is not a functionが出たとき

Posted at

概要

@testing-library/react": "11.2.6" でテストを実行すると以下のエラーが発生した

以下を参考に正常化したので方法を残す

 Navigation Test Cases
    ✕ Should route to selected page in navbar (463 ms)

  ● Navigation Test Cases › Should route to selected page in navbar

    TypeError: expect(...).toBeInTheDocument is not a function

対処方法

@testing-library/jest-domTestファイルに記述する

hoge.test.tsx
import '@testing-library/jest-dom'
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?