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

Aperta
#602 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cypress, typescript
Ambito
testing

Direzione di ricerca

Inizia riproducendo il malfunzionamento con il commit imagelightbox collegato e ispeziona support.js in generateReport, i dati di .nyc_output/out.json e le voci dello stack NYC/istanbul indicate nei log. Verifica il percorso del task coverageReport di Cypress after-all. Il lavoro è completato quando la spec termina e la generazione del report di coverage produce il suo output lcov senza l’undefined start error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
440
Fork
114
Merge medio
42m
PR unite (30g)
19

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cypress-io/code-coverage

Tutte le issue di cypress-io/code-coverage

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.