@cypress/code-coverage attempts to collect back-end coverage when we are not running end-to-end tests
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cypress, typescript
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Issue trỏ đến support.js ở các dòng 168-172 và đề xuất PR #474; hãy bắt đầu bằng việc xem xét logic đó cùng cấu hình expectBackendCoverageOnly hiện có. Xác nhận hành vi của các integration specs khi expectFrontendCoverageOnly được bật, đồng thời giữ nguyên hành vi end-to-end hiện tại. Hoàn tất khi plugin không cố truy cập URL /coverage bị thiếu trong trường hợp đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Logs and screenshots
code-coverage combined NYC options { 'report-dir': './coverage', reporter: [ 'lcov', 'json-summary', 'text', 'cobertura' ], extension: [ '.jsx', '.js' ], excludeAfterRemap: false, sourceMap: false, instrument: false } +0ms
code-coverage reset code coverage in interactive mode +0ms
code-coverage reset code coverage in interactive mode +2s
code-coverage parsed sent coverage +8s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +30ms
code-coverage parsed sent coverage +721ms
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/
code-coverage parsed sent coverage +2s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +61ms
code-coverage parsed sent coverage +915ms
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +54ms
code-coverage parsed sent coverage +799ms
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +57ms
code-coverage parsed sent coverage +3s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +50ms
code-coverage parsed sent coverage +2s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +53ms
Versions
- @cypress/code-coverage v3.9.7
- Cypress 7.0.1
- OS: MacOS Big Sur 11.4
- shell: bash
- Node v14.16.0
- NPM 6.14.11
- How do you instrument your application?
babel-plugin-istanbul - do you see
window.__coverage__object? yes,window.__coverage__exists and instrumentation works - Is there
.nyc_outputfolder? yes coverage data is generated - custom NYC settings in
package.json
"nyc": {
"extension": [
".jsx",
".js"
],
"reporter": [
"lcov",
"json-summary",
"text",
"cobertura"
],
"sourceMap": false,
"instrument": false
},
- Do you run Cypress tests in a Docker container? yes in CI, MacOS locally
Describe the bug
The logic to determine if cypress is running an "end-to-end" test incorrectly resolves as true in my cypress tests, as our baseUrl and proxyUrl are different.
Code reference in question:
https://github.com/cypress-io/code-coverage/blob/c51751f9f9875c88aaacf648c738bec63b4163f1/support.js#L168-L172
From the above code, runningEndToEndTests evaluates to true if your baseUrl and proxyUrl are different, which they are in my case but I am not running end-to-end tests.

As my specType is integration, after tests complete an attempt is made to reach a /coverage URL which does not exist, thus failing the test.

I would like to propose perhaps setting & checking against a new config codeCoverage.expectFrontendCoverageOnly explicitly to determine if backend coverage needs to be collected (similar to the pre-existing expectBackendCoverageOnly config), eg. the above code reference could be augmented to preserve the existing behavior but allowing an explicit check against expectFrontendCoverageOnly
const runningEndToEndTests = baseUrl !== Cypress.config('proxyUrl')
const specType = Cypress._.get(Cypress.spec, 'specType', 'integration')
const isIntegrationSpec = specType === 'integration'
const expectFrontendCoverageOnly = Cypress._.get(Cypress.env('codeCoverage'), 'expectFrontendCoverageOnly',
false)
if (!expectFrontendCoverageOnly && runningEndToEndTests && isIntegrationSpec) {
Link to the repo
The code I am using @cypress/code-coverage is behind a private GH instance so I unfortunately can't share here. I have created https://github.com/cypress-io/code-coverage/pull/474 with the above suggestion
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cypress-io/code-coverage
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 40/100
cypress-io/code-coverage#1018 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
cypress-io/code-coverage#993 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
cypress-io/code-coverage#967 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
cypress-io/code-coverage#959 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
performance
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
cypress-io/code-coverage#933 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của cypress-io/code-coverage
Issue tương tự
-
Navbar avatar and name stay stale after saving profile changesCó thể đã có người làm @alexechoi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
marmelab/atomic-crm#416 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
bluesky-social/social-app#12343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
lucide-icons/lucide#5165 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] Preferences - Keep the theme selection popover open after selection for quick previewĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
marktext/marktext#6033 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:desktop bug has repro platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
anthropics/claude-code#107903 ·