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

Đang mở
#777 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cypress, nextjs, typescript
Lĩnh vực
testing

Hướng nghiên cứu

Kiểm tra support.js xung quanh collectBackendCoverage, được xác định gần dòng 151 trong stack trace, và tái hiện một test thất bại đi tới afterAll trước cy.visit khi cả origin của window và baseUrl đều trống. Hoàn tất khi frontend coverage vẫn hoàn thành mà không cố thực hiện cy.request() không hợp lệ khi backend coverage không được thu thập.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)
Ngôn ngữ chính
TypeScript
Star
440
Fork
114
Merge trung bình
42 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cypress-io/code-coverage

Tất cả issue của cypress-io/code-coverage

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.