-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test: migrate suspense test to e2e for react 19/canary #4173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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. |
There was a problem hiding this 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.
69d8491
to
9859311
Compare
There was a problem hiding this 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.
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.