@testing-library/react behaves differently when dealing with Suspense in React 18 and React 19
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, react
- Área
- frontend, testing-qa
Línea de trabajo
Comienza con la reproducción enlazada, comparando las pruebas y configuraciones idénticas en sus carpetas react-18 y react-19. Ejecuta npm test en cada carpeta e inspecciona el comportamiento de renderizado, Suspense, fallback y contenido resuelto descrito en el issue. Se considera terminado cuando las pruebas relevantes ya no se quedan atascadas en el fallback y el comportamiento es coherente entre React 18 y React 19.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
@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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 19.7k
- Forks
- 1.2k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de testing-library/react-testing-library
-
fireEvent.select does not wrap its automatic native focus in actPosiblemente ocupada @sergioperezcheco la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
bug: calling configure() without reactStrictMode resets it to undefined, silently disabling strict modeQuizá libre de nuevo @suhailopensource la tomó hace 77 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
testing-library/react-testing-library#1466 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
testing-library/react-testing-library#1459 · 2 comentarios ·
-
perf: optimize container lookup with early exitQuizá libre de nuevo @Ch-Abhinav-Chowdary la tomó hace 303 días y no hay ningún pull request abierto. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
testing-library/react-testing-library#1430 · 1 comentario ·
-
`fireEvent.mouseEnter` does not forward `relatedTarget` (relatedTarget is the window instead)Posiblemente ocupada @swarnim02 la tomó hace 320 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Todos los issues de testing-library/react-testing-library
Issues similares
-
🐞 bug pending triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
CircuitVerse/CircuitVerse#8025 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
schmayterling/hibi#245 ·
Los mantenedores suelen responder en 1 día
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
vercel/ai#23304 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug package:vitest
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cloudflare/workers-sdk#16255 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Proxy and MCP URLs with an empty authority parse as a different hostPosiblemente ocupada @ericcaiwx-star la tomó hoy. Abiertoclawsweeper:bulk-filed clawsweeper:linked-pr-open clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
openclaw/openclaw-enterprise#2384 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día