Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
willrichboa opened this issue Feb 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@willrichboa
Copy link

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)
@jennifer-shehane jennifer-shehane added the bug Something isn't working label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants