Do not generate a coverage report when visiting local HTML files with `expectBackendCoverageOnly` enabled

Đang mở
#906 0 bình luận 0 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, typescript
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu tại cypress/plugins/index.js và theo dõi cách cấu hình code coverage xử lý cy.visit khi baseUrl được đặt thành null và expectBackendCoverageOnly được bật. Tái hiện hai lần visit trong issue, so sánh trường hợp cục bộ cypress/downloads/test.html với URL bên ngoài. Hoàn tất khi lần visit HTML cục bộ không còn tạo ra lỗi no-coverage-information, trong khi coverage của backend vẫn tiếp tục hoạt động.

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

Mô tả

Problem:
When visiting a local HTML file (cypress/downloads/test.html), the coverage report is not generated. However, when visiting an external URL like https://docs.cypress.io/app/tooling/code-coverage, the coverage report is successfully generated.

and the error message is code-coverage/test-apps/backend/.nyc_output/out.json has no coverage information Did you forget to instrument your web application?

Cypress Configuration:

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  fixturesFolder: false,
  env: {
    codeCoverage: {
      url: 'http://localhost:3003/__coverage__',
      expectBackendCoverageOnly: true
    },
  },
  e2e: {
    setupNodeEvents(on, config) {
      return require('./cypress/plugins/index.js')(on, config)
    },
    baseUrl: 'http://localhost:3003',
  },
})

Test Spec:

/// <reference types="Cypress" />

context('Converage Test', () => {
  it('backend test', function() {
    cy.visit('/')
    cy.request('/hello')
  })


  it('visit local html file', {baseUrl: null}, () => {
    cy.visit('cypress/downloads/test.html') // failed to generate coverage report
    // cy.visit('https://docs.cypress.io/app/tooling/code-coverage') //Successfully generated the coverage report.
  })
})
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.