testing-library / testing-library/react-testing-library
Support for React Server Components
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 19.7k
- Forks
- 1.2k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 1
Description
Describe the feature you'd like:
As a user of react 18 with NextJS (with app directory), I would like to render async server components
example:
// Page.tsx
const Page = async ({ params, searchParams }: PageProps) => {
const asyncData = await fetchSomeDataAsynchronously()
return (<foo {...asyncData} />
}
...
// Page.test.tsx
it('should render', () => {
render(<Page />)
expect(screen....).ToBe(....)
})
Extracting server page logic would be an alternative, but I think that would also significantly reduce the purpose of RTL if that were to become an encouraged architectural default.
Current progress, workarounds, and demo
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Page.tsx and Page.test.tsx examples, then review the linked current-progress, workaround, and demo comment. Done means establishing a supported way to render and test an asynchronous React Server Component with the requested behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, react, typescript
- Domain
- frontend, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100