2
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?

TestingLibraryElementError: Found multiple elements with the text: /Reactの学習/

2
Posted at

はじめに

問題

  • 要素が取れているはずなのにエラーになる

解決

  • Found multiple elements なので複数要素が出ていたのがエラーと言うこと
  • cleanupができておらず、 render(<Component />) が複数回走っていたので、以下追加して解決
afterEach(() => {
    cleanup();
});

終わりに

2
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
2
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?