testing custom hook within a component scope throws TypeError not a function
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, next.js, react
調査の方向性
ファイルや失敗しているテストは指定されていません。まず、記載されている React 17、Next.js、@testing-library/react 12.1.5、@testing-library/react-hooks 8.0.1 のバージョンでコンポーネントテストを再現し、次にコンポーネントが使用しているカスタムフックのインポートを追跡してください。再現可能な原因を特定し、互換性のある修正を文書化できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
when I run my unit tests to test componernts, I recieve errors similar to this one in multiple places:
TypeError: (0 , _fileName.useCustomHook) is not a function
when I test the hook itself alone it works fine, but I don't want to test the hook I want to test the component and the component have data that depends on my custom hook
Notes:
- this was working last week with no errors and I didn't edit any code
- I have looked at the packages nothing was updated since then
- the codebase is Next.js so we can't update RTL to v13 yet as we have React v17 and the dep. tree won't fit together so we have
@testing-library/react": "^12.1.2 and @testing-library/react-hooks: "^8.0.1", - I have updated RTL to 12.1.5 which is the latest version of v12 but same error
can someone please help with this?
- 主要言語
- JavaScript
- スター
- 19.7k
- フォーク
- 1.2k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
testing-library/react-testing-library のほかの issue
-
fireEvent.select does not wrap its automatic native focus in act対応中かも @sergioperezcheco が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict mode再び着手できるかも @suhailopensource が 77 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
testing-library/react-testing-library#1466 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
testing-library/react-testing-library#1459 · コメント 2 件 ·
-
perf: optimize container lookup with early exit再び着手できるかも @Ch-Abhinav-Chowdary が 303 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
testing-library/react-testing-library#1430 · コメント 1 件 ·
-
`fireEvent.mouseEnter` does not forward `relatedTarget` (relatedTarget is the window instead)対応中かも @swarnim02 が 321 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
testing-library/react-testing-library の issue をすべて見る
似ている issue
-
feature request
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
docs hacktoberfest help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
pacocartones/free-llm-api-hub#347 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cytoscape/cytoscape.js#3536 ·
メンテナーはふだん 15 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cuttle-cards/cuttle#1440 ·
メンテナーはふだん 1 日以内に返信
-
URL-encoded parser builds nested objects nothing reads対応中かも @Senthil455 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
Janani-bn/CivicFix#168 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信