@testing-library/react behaves differently when dealing with Suspense in React 18 and React 19
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 30/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- javascript, react
- Domínio
- frontend, testing-qa
Direção de pesquisa
Comece com a reprodução vinculada, comparando os testes e as configurações idênticos nas pastas react-18 e react-19. Execute npm test em cada pasta e inspecione o comportamento de renderização, Suspense, fallback e conteúdo resolvido descrito na issue. Está concluído quando os testes relevantes não permanecerem mais travados no fallback e o comportamento for consistente entre React 18 e React 19.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
@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.
- Linguagem predominante
- JavaScript
- Estrelas
- 19.7k
- Forks
- 1.2k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de testing-library/react-testing-library
-
fireEvent.select does not wrap its automatic native focus in actTalvez já em andamento @sergioperezcheco assumiu há 10 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
-
bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict modeTalvez livre de novo @suhailopensource assumiu há 80 dias e não há nenhum pull request aberto. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
testing-library/react-testing-library#1466 · 1 comentário ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 30/100
testing-library/react-testing-library#1459 · 2 comentários ·
-
perf: optimize container lookup with early exitTalvez livre de novo @Ch-Abhinav-Chowdary assumiu há 306 dias e não há nenhum pull request aberto. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 35/100
testing-library/react-testing-library#1430 · 1 comentário ·
-
`fireEvent.mouseEnter` does not forward `relatedTarget` (relatedTarget is the window instead)Talvez já em andamento @swarnim02 assumiu há 323 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
Todas as issues de testing-library/react-testing-library
Issues semelhantes
-
BUG
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
[BUG]: filesystem-edit-file converts a CRLF file's line endings to LF on every editTalvez já em andamento @MohammadHijjawi97 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mintplex-Labs/anything-llm#6755 ·
Mantenedores costumam responder em até 1 dia
-
type/bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
flarum/framework#5231 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
apache/rocketmq-dashboard#6896 ·
Mantenedores costumam responder em até 3 dias
-
bug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia