Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✅ What's done
Expo SDK 48アップグレードの対応で、
App.test.tsx
を実行すると以下のエラーが発生jest/__mocks__
配下のモックファイルは、モックしているライブラリなどがimport
、require
されたときに読み込まれます。テスト対象のコンポーネントの内部で、条件によって
require
するライブラリを切り替えている箇所があり、それが原因でこのエラーが発生したと思われます。そのため、
jest/__mocks__
配下のモックファイルでモックをクリアするのをやめて、jest.config.js
のclearMocksを有効化する方法で、テスト実施前にモックをクリアします。jest.config.js
のclearMocks
をtrue
に設定beforeEach
やbeforeAll
でモックをクリアしていた箇所を削除git grep mockClear
git grep clearAllMocks
Other (messages to reviewers, concerns, etc.)
関連