@testing-library/react behaves differently when dealing with Suspense in React 18 and React 19
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, react
- 領域
- frontend, testing-qa
調査の方向性
リンクされた再現コードから始め、react-18 フォルダーと react-19 フォルダーにある同一のテストと設定を比較します。各フォルダーで npm test を実行し、issue に記載された render、Suspense、fallback、resolved content の動作を確認します。関連するテストが fallback で停止したままにならず、React 18 と React 19 で動作が一貫していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
@testing-library/reactversion: 16.1.0- Testing Framework and version: jest 29.7.0
- DOM Environment: jsdom 29.7.0
Relevant code or config:
render(
<Suspense fallback="fallback">
<TestComponent />
</Suspense>
);
expect(screen.getByText("fallback")).toBeInTheDocument();
expect(await screen.findByText("resolved")).toBeInTheDocument();
What you did:
We're upgrading our codebase from React 18.3.1 to React 19.0.0.
What happened:
Over 300 tests started to fail because of suspended components kept rendering their fallbacks and never their children.
Reproduction:
In this repo we created a minimal reproduction for the issue we're facing.
It contains a folder react-18 and a folder react-19 that contains the same dependencies, configuration and code, except for the React version.
In both code bases there's the same test. It passes on the React 18 project, but fails in 2 different ways in the React 19 one.
Run npm test in each folder to see the output.
Problem description:
By default, a test that uses Suspense gets stuck rendering the fallback on React 19.
RTL emits a warning to wrap the render method in an awaited act. Following the suggestion leads the component to un-suspend, but make it impossible to assert against its fallback.
Suggested solution:
We don't have a solution for this problem, but we think RTL should behave the same with React 18 and React 19.
- 主要言語
- 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 が 78 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 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 が 304 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 8 日以内に返信
-
docs(stream-protocol): document messageMetatadata on start/finish and the message-metadata chunkオープンfactory-active task-identify-harness-labels-done task-identify-issue-type-done
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
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 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
wpilibsuite/wpilib-docs#3378 ·
メンテナーはふだん 1 日以内に返信