LoginSignup
0
0

More than 3 years have passed since last update.

React躓きメモ

Last updated at Posted at 2020-11-26

Async callback was not invoked within the 5000ms timeout specified by jest.setTimeoutでjestのテストが上手くいかないケース

it("テストネーム", async () => {
  // settimeoutを繰り返すようなテスト
}, 時間);

上記のように、itの第3引数に時間を入れることで上手くいくらしい

useEffectがstateなどで何度もレンダリングされてしまう。

https://qiita.com/k-penguin-sato/items/9373d87c57da3b74a9e
以下のように第2引数をから配列にすればいいらしい。

useEffect(() => {
// 処理
}, []);

jestでカバレッジが解消されない

循環参照されているのが原因だったため、コーディングのファイルの位置関係を見直すこと。

window.visualViewportでエラーが発生してしまう。

https://r17n.page/2019/11/21/fix-typescript-window-object-access-error/
https://dev.classmethod.jp/articles/typings-of-window-object/

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