collectBackendCoverage fails in afterAll step when the window's origin and baseUrl are both blank

Abierto
#777 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cypress, nextjs, typescript
Área
testing

Línea de trabajo

Inspecciona support.js alrededor de collectBackendCoverage, identificado cerca de la línea 151 en el stack trace, y reproduce una prueba fallida que llegue después de afterAll y antes de cy.visit con el origen de window y baseUrl en blanco. Está hecho cuando la cobertura del frontend se completa sin intentar un cy.request() inválido cuando no se está recopilando la cobertura del backend.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

I am running a cypress project that does not set "baseUrl" in our config file for various reasons. I am trying to add the code-coverage plugin, but only for front end metrics with our instrumented NextJs app.

Everything works except when we encounter the following scenario. When running a test that fails before it has executed cy.visit, so it has a blank window origin, and of course baseUrl is not set, then during the "afterAll" step the code coverage plugin fails with the following message. about collectBackendCoverage. Again we are not attempting to collect backend coverage so this is some default behavior of the plugin that should not be default behavior.

`cy.request()` must be provided a fully qualified `url` - one that begins with `http`. By default `cy.request()` will use either the current window's origin or the `baseUrl` in `cypress.config.ts`. Neither of those values were present.

https://on.cypress.io/request

Because this error occurred during a `after all` hook we are skipping all of the remaining tests.

Although you have test retries enabled, we do not retry tests when `before all` or `after all` hooks fail
  CypressError: `cy.request()` must be provided a fully qualified `url` - one that begins with `http`. By default `cy.request()` will use either the current window's origin or the `baseUrl` in `cypress.config.ts`. Neither of those values were present.
  
  https://on.cypress.io/request
      at Context.request (http://localhost:3000/__cypress/runner/cypress_runner.js:132841:70)
      at wrapped (http://localhost:3000/__cypress/runner/cypress_runner.js:138282:43)
  From Your Spec Code:
      at Context.collectBackendCoverage (webpack://myproject/./node_modules/@cypress/code-coverage/support.js:151:0)
Lenguaje dominante
TypeScript
Estrellas
440
Forks
114
Merge medio
42 min
PR fusionados (30 d)
19

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cypress-io/code-coverage

Todos los issues de cypress-io/code-coverage

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.