serveStaticJson and serveStaticText failing default CORS tests in dev-middleware
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- javascript, react-native
- Área
- devtools, testing-qa
Línea de trabajo
Comienza con packages/dev-middleware/src/tests/ServerUtils-test.js y ejecuta el comando de Yarn Jest indicado. Inspecciona serveStaticJson y serveStaticText para determinar si la ausencia del encabezado CORS refleja el contrato previsto; la tarea se completa cuando las pruebas y la implementación coinciden y el archivo de prueba específico pasa.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
During the development of the dev-middleware package, the automated tests for serveStaticJson and serveStaticText fail because they expect default Access-Control-Allow-Origin headers in the response. The current implementation no longer includes these headers by default.
This causes test failures even though the main functionality of serving JSON or text works correctly.
Steps to reproduce
- Clone the repository.
2 . Run: yarn jest packages/dev-middleware/src/tests/ServerUtils-test.js --runInBand --verbose
- Observe that the tests for serveStaticJson and serveStaticText fail due to missing CORS headers.
Expected behavior:
Tests should pass or be updated to reflect the current implementation.
Actual behavior:
Tests fail because the response does not include "Access-Control-Allow-Origin": "*" as previously expected.
React Native Version
0.82.1
Affected Platforms
Build - MacOS
Output of npx @react-native-community/cli info
System:
OS: macOS 14.1.1
CPU: (10) arm64 Apple M1 Max
Memory: 417.81 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0
Yarn: 1.22.22
npm: 10.9.4
SDKs:
iOS SDK: 17A400
Android SDK: 33
npmPackages:
react: 19.1.1
react-native: 0.82.1
Stacktrace or Logs
FAIL packages/dev-middleware/src/__tests__/ServerUtils-test.js
ServerUtils
✕ serveStaticJson sets CORS header (285 ms)
✕ serveStaticText sets CORS header
✓ baseUrlForServer returns correct URL (1 ms)
● ServerUtils › serveStaticJson sets CORS header
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: 200, ObjectContaining {"Access-Control-Allow-Origin": "*", "Content-Type": "application/json"}
Received: 200, {"Content-Type": "application/json"}
● ServerUtils › serveStaticText sets CORS header
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: 200, ObjectContaining {"Access-Control-Allow-Origin": "*", "Content-Type": "text/plain"}
Received: 200, {"Content-Type": "text/plain"}
MANDATORY Reproducer
https://github.com/THE-Amrit-mahto-05/react-native-dev-middleware-repo.git
Screenshots and Videos
https://github.com/user-attachments/assets/bbec821b-f0a8-42a3-be58-a17fdceabf08
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
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 react/react-native
-
Needs: Author Feedback Needs: Repro
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
react/react-native#58621 · 1 comentario ·
-
Needs: Author Feedback Needs: Repro
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
react/react-native#58610 · 1 comentario ·
-
Needs: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
react/react-native#58565 · 1 comentario · 2 reacciones ·
-
Needs: Author Feedback Needs: Repro
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
react/react-native#58555 · 5 comentarios · 2 reacciones ·
-
Needs: Attention Needs: Repro
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
react/react-native#58526 · 2 comentarios ·
Todos los issues de react/react-native
Issues similares
-
ai_reviewed
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ydb-platform/ydb#53869 · 3 comentarios ·
-
bug cert blocker needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
project-chip/connectedhomeip#74373 ·
-
[request] tracy/0.14.1 Abiertoupstream update
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
conan-io/conan-center-index#31035 ·
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
vllm-project/vllm-ascend#17329 ·