Cypress error: `cy.task('coverageReport')` failed - Cannot read properties of undefined (reading 'start')

Đang mở
#602 2 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/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 bằng cách tái hiện lỗi với commit imagelightbox được liên kết và kiểm tra support.js tại generateReport, dữ liệu .nyc_output/out.json và các stack entry NYC/istanbul được nêu trong log. Xác minh đường dẫn task coverageReport của Cypress after-all. Được xem là hoàn tất khi spec chạy xong và coverage reporting tạo ra đầu ra lcov mà không có undefined start error.

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

Mô tả

Logs and screenshots
Hi,
I get the following error in cypress (this is the output from "Print to console"):

CypressError: `cy.task('coverageReport')` failed with the following error:

> Cannot read properties of undefined (reading 'start')

Because this error occurred during a `after all` hook we are skipping all of the remaining tests.
    at ../driver/src/cy/commands/task.ts/__webpack_exports__.default/task (http://localhost:8080/__cypress/runner/cypress_runner.js:145775:78)
From previous event:
    at task (http://localhost:8080/__cypress/runner/cypress_runner.js:145757:10)
    at ../driver/src/cypress/cy.ts/addCommand/wrap (http://localhost:8080/__cypress/runner/cypress_runner.js:157372:43)
From Your Spec Code:
    at generateReport (webpack:///./node_modules/@cypress/code-coverage/support.js:200:0)
    at ../driver/src/cypress/cy.ts/setRunnable/runnable.fn (http://localhost:8080/__cypress/runner/cypress_runner.js:157640:43)
    at callFn (http://localhost:8080/__cypress/runner/cypress_runner.js:107910:21)
    at ../driver/node_modules/mocha/lib/runnable.js/</Runnable.prototype.run (http://localhost:8080/__cypress/runner/cypress_runner.js:107897:13)
    at ../driver/src/cypress/runner.ts/create/onRunnableRun (http://localhost:8080/__cypress/runner/cypress_runner.js:164958:30)
    at finallyHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:7872:23)
    at tryCatcher (http://localhost:8080/__cypress/runner/cypress_runner.js:11318:23)
    at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromiseFromHandler (http://localhost:8080/__cypress/runner/cypress_runner.js:9253:31)
    at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise (http://localhost:8080/__cypress/runner/cypress_runner.js:9310:18)
    at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromise0 (http://localhost:8080/__cypress/runner/cypress_runner.js:9355:10)
    at ../../node_modules/bluebird/js/release/promise.js/</module.exports/Promise.prototype._settlePromises (http://localhost:8080/__cypress/runner/cypress_runner.js:9435:18)
    at _drainQueueStep (http://localhost:8080/__cypress/runner/cypress_runner.js:6025:12)
    at _drainQueue (http://localhost:8080/__cypress/runner/cypress_runner.js:6018:24)
    at ../../node_modules/bluebird/js/release/async.js/</Async.prototype._drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:6034:16)
    at ../../node_modules/bluebird/js/release/async.js/</Async/this.drainQueues (http://localhost:8080/__cypress/runner/cypress_runner.js:5904:14)


From Node.js Internals:
  TypeError: Cannot read properties of undefined (reading 'start')
      at <unknown> (/home/user/project/node_modules/istanbul-reports/lib/lcovonly/index.js:59:43)
  at Array.forEach (<anonymous>)
      at LcovOnlyReport.onDetail (/home/user/project/node_modules/istanbul-reports/lib/lcovonly/index.js:56:34)
      at LcovReport.<computed> [as onDetail] (/home/user/project/node_modules/istanbul-reports/lib/lcov/index.js:25:23)
      at Visitor.value (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:38:38)
      at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:88:21)
      at <unknown> (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:92:19)
  at Array.forEach (<anonymous>)
      at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:91:28)
      at <unknown> (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:92:19)
  at Array.forEach (<anonymous>)
      at ReportNode.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:91:28)
      at ReportTree.visit (/home/user/project/node_modules/istanbul-lib-report/lib/tree.js:127:24)
      at LcovReport.execute (/home/user/project/node_modules/istanbul-lib-report/lib/report-base.js:12:44)
      at <unknown> (/home/user/project/node_modules/nyc/index.js:467:10)
  at Array.forEach (<anonymous>)
      at NYC.report (/home/user/project/node_modules/nyc/index.js:461:19) [index.ce8ed54d.js:99335:13](http://localhost:8080/__/assets/index.ce8ed54d.js)

Versions

  • What is this plugin's version? 3.10.0
  • What is Cypress version? 10.10.0
  • What is your operating system? Debian testing
  • What is the shell? zsh
  • What is the Node version? v18.11.0
  • What is the NPM version? 8.19.2
  • How do you instrument your application? gulp-istanbul
  • When running tests, if you open the web application in regular browser, and open DevTools, do you see window.__coverage__ object? Yes

image

  • Is there .nyc_output folder? Is there .nyc_output/out.json file. Is it empty? Can you paste at least part of it so we can see the keys and file paths?

There is, pasting out.json:

{
  "/home/user/project/src/file.js": {
    "path": "/home/user/project",
    "s": {
      "1": 1,
      "2": 1,
      "3": 1
      "...": "truncated"
    }
  }
}
  • Do you have any custom NYC settings in package.json (nyc object) or in other NYC config files No
  • Do you run Cypress tests in a Docker container? No

Describe the bug
When running a spec file, I get the error reported above.

Link to the repo
https://github.com/marekdedic/imagelightbox/commit/36513ec34716c92046bec270979108b5e3a23111

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.