Skip to content

Conversation

promer94
Copy link
Collaborator

@promer94 promer94 commented Sep 21, 2025

This pr is based on #4172

since @testing-library/react behaves differently when dealing with Suspense in React 18 and React 19.

Our current test implementation won't work for react 19 and react canary. The workround provided by react-testing-library is not solid and stable.

I suggested we could migrate Suspense related tests to e2e tests and skip this test for react canary ci.

Copy link

socket-security bot commented Sep 21, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​types/​use-sync-external-store@​0.0.3 ⏵ 1.5.010010062 -178100
Updatedhusky@​8.0.3 ⏵ 9.1.7100 +110062 -1779100
Updatedjest@​29.7.0 ⏵ 30.1.3100 +110069 +196100
Updated@​typescript-eslint/​parser@​5.59.8 ⏵ 8.44.010010071 +497 +1100
Updateduse-sync-external-store@​1.4.0 ⏵ 1.5.01001007196100
Updated@​types/​jest@​29.5.12 ⏵ 30.0.01001007779100
Updated@​edge-runtime/​jest-environment@​3.0.4 ⏵ 4.0.0100 +110078 -178 -1100
Updatedrimraf@​5.0.1 ⏵ 6.0.19910010078100
Updatedeslint-plugin-jest-dom@​5.1.0 ⏵ 5.5.0100 +110010079 +2100
Updated@​types/​react@​18.2.8 ⏵ 18.3.24100 +110079 +295 +1100
Updated@​typescript-eslint/​eslint-plugin@​5.59.8 ⏵ 8.44.09910080 +397 +1100
Updated@​swc/​jest@​0.2.26 ⏵ 0.2.39100100100 +180 -3100
Updated@​types/​node@​20.2.5 ⏵ 22.18.61001008196 +1100
Updated@​eslint/​eslintrc@​2.0.3 ⏵ 3.3.199 +1100100 +782100
Updatedreact-error-boundary@​4.0.9 ⏵ 5.0.0100100100 +183 +1100
Updatedeslint-plugin-react@​7.32.2 ⏵ 7.37.59910010084100
Updatedreact@​18.2.0 ⏵ 18.3.1100 +110085 +197100
Updatedglobals@​13.19.0 ⏵ 16.4.010010085 -291100
Updated@​arethetypeswrong/​cli@​0.15.3 ⏵ 0.18.2100 +1100100 +186100
Updated@​testing-library/​react@​14.2.1 ⏵ 16.3.010010010087 +1100
Updatedeslint-config-prettier@​8.8.0 ⏵ 10.1.8100 +1100100 +3087100
Updated@​testing-library/​dom@​9.2.0 ⏵ 10.4.19910010088100
Added@​eslint/​compat@​1.3.210010010088100
Updatedprettier@​2.8.8 ⏵ 3.6.29910010090100
Updatedtypescript@​5.3.3 ⏵ 5.9.210010090100100
Updated@​eslint/​js@​8.42.0 ⏵ 9.36.010010091 +596 +1100
Updatedlint-staged@​13.2.2 ⏵ 16.1.699 +1100100 +191 +1100
Updatedbunchee@​6.3.2 ⏵ 6.6.092 -4100100 +193 +3100
Updatedreact-dom@​18.2.0 ⏵ 18.3.1100 +110092 +197100
Updated@​testing-library/​jest-dom@​5.16.5 ⏵ 6.8.0100 +110010092100
Updated@​swc/​core@​1.3.93 ⏵ 1.13.592 +2100100 +395 +1100
Updatedeslint-plugin-react-hooks@​4.6.0 ⏵ 5.2.0100100100 +796100
Updatedeslint@​8.42.0 ⏵ 9.36.097 +110010096 +1100
See 2 more rows in the dashboard

View full report

@promer94 promer94 requested review from Copilot and removed request for huozhi and shuding September 21, 2025 06:06
Copy link

codesandbox-ci bot commented Sep 21, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates React Suspense-related tests from unit tests to end-to-end (e2e) tests to address compatibility issues between @testing-library/react and React 19's Suspense behavior. The migration includes creating a utility function to conditionally skip Suspense tests in React Canary CI environments.

Key changes:

  • Adds itShouldSkipForReactCanary utility function to conditionally skip tests in React Canary environments
  • Migrates multiple Suspense test scenarios to dedicated e2e test pages and test suites
  • Updates Jest expectations from deprecated methods to modern alternatives
  • Removes redundant ESLint disable comments and updates configuration files

Reviewed Changes

Copilot reviewed 75 out of 79 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/utils.tsx Adds utility function for skipping tests in React Canary CI
test/use-swr-suspense.test.tsx Wraps all Suspense tests with conditional skip utility
test/use-swr-promise.test.tsx Wraps promise-related Suspense tests with conditional skip
test/use-swr-preload.test.tsx Wraps preload Suspense tests with conditional skip
test/use-swr-infinite.test.tsx Wraps infinite Suspense test with conditional skip
test/use-swr-fetcher.test.tsx Wraps fetcher Suspense test with conditional skip
e2e/test/suspense-scenarios.test.ts New comprehensive e2e test suite for all Suspense scenarios
e2e/test/promise-scenarios.test.ts New e2e tests for promise-related Suspense behavior
e2e/test/preload-scenarios.test.ts New e2e tests for preload Suspense functionality
e2e/site/app/* Multiple new test pages implementing Suspense scenarios
package.json Updates dependencies and package manager version
eslint.config.mjs New flat ESLint configuration replacing legacy format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@promer94 promer94 requested review from huozhi and shuding September 21, 2025 06:20
@promer94 promer94 force-pushed the test/migrate-react19-suspense-test-e2e branch from 69d8491 to 9859311 Compare September 21, 2025 06:23
@promer94 promer94 changed the title test: migrate react19 suspense test e2e test: migrate suspense test to e2e for react 19/canary Sep 21, 2025
@promer94 promer94 requested a review from Copilot September 21, 2025 06:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 75 out of 79 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant