Unable to generate Code Coverage report - 'Cannot find coverage file'

Aperta
#756 5 commenti 3 reazioni 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
babel, node.js, typescript, webpack
Ambito
testing-qa

Direzione di ricerca

Inizia riproducendo il malfunzionamento con Cypress 13.6.1, @cypress/code-coverage 3.12.15 e la versione di Node indicata, quindi esamina cypress.config.ts, cypress/plugins/index.js e cypress/support/e2e.ts. Segui il task di code coverage e la configurazione di supporto per determinare perché cypress/coverage/temp/out.json non viene prodotto; il lavoro è completo quando vengono generati i report di coverage invece di essere ignorati.

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

Descrizione

I recently upgraded the Cypress version to 13.6.1 from 9.6.x and the coverage reports stopped working. Followed all the steps mentioned in this guide https://docs.cypress.io/guides/tooling/code-coverage#E2E-code-coverage

Debug Log

code-coverage combined NYC options { 'report-dir': './cypress/coverage/ui', reporter: [ 'lcov', 'clover', 'json', 'json-summary' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: false, 'temp-dir': './cypress/coverage/temp' } +0ms

Coverage failure message

Cannot find coverage file /ui-workspace/cypress/coverage/temp/out.json
Skipping coverage report

Versions

  • What is this plugin's version? If this is NOT the latest released version, can you try the latest version, please?
    "@cypress/code-coverage": "3.12.15",
    "cypress": "13.6.1"
  • If the plugin worked before in version X but stopped after upgrading to version Y, please try the released versions between X and Y to see where the breaking change was.
  • What is the Cypress version? - 13.6.1
  • What is your operating system? - Mac OS Ventura
  • What is the shell? - OMZ
  • What is the Node version? - v16.18.1
  • What is the NPM version? - 8.19.2
  • How do you instrument your application? Cypress does not instrument web application code, so you must do it yourself. - Via babel using webpack
  • When running tests, if you open the web application in a regular browser and open DevTools, do you see window.__coverage__ object? Can you paste a screenshot?
  • Is there a .nyc_output folder? Is there a .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? - it is empty
  • 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? - The issue is happening in both Mac OS and Linux based Docker Containers.

Here is some additional information
cypress.config.ts file

....
e2e: {
    setupNodeEvents(on, config) {
      require('./cypress/plugins/index.js')(on, config);
      return config;
    },
  }]
...

cypress/plugins/index.js file

const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');

module.exports = (on, config) => {
  if (config && config.env && config.env.recordCodeCoverage) {
    on('file:preprocessor', cypressTypeScriptPreprocessor);

    // enable code coverage collection
    require('@cypress/code-coverage/task')(on, config);
  }

  // IMPORTANT to return the config object
  // with the any changed environment variables
  return config;
};

cypress/support/e2e.ts file

import '@cypress/code-coverage/support';

Any help is appreciated.

Thanks,
Nathan

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.