BREAKING: support specPattern, drop support for integrationFolder

Aperta
#536 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cypress, javascript
Ambito
testing

Direzione di ricerca

Inizia individuando le versioni sorgente di support-utils.js e support.js invece delle copie patchate in node_modules. Esamina il modo in cui Cypress.config fornisce testFiles, specPattern, integrationFolder e supportFile, quindi verifica che il filtraggio della coverage segua la configurazione più recente e non dipenda più da integrationFolder.

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

Descrizione

Via patch package.


Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @cypress/[email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@cypress/code-coverage/support-utils.js b/node_modules/@cypress/code-coverage/support-utils.js
index 31e00ee..0c56908 100644
--- a/node_modules/@cypress/code-coverage/support-utils.js
+++ b/node_modules/@cypress/code-coverage/support-utils.js
@@ -10,7 +10,7 @@ const filterSpecsFromCoverage = (totalCoverage, config = Cypress.config) => {
   const integrationFolder = config('integrationFolder')
   /** @type {string} Cypress run-time config has test files string pattern */
   // @ts-ignore
-  const testFilePattern = config('testFiles')
+  const testFilePattern = config('specPattern')
 
   // test files chould be:
   //  wild card string "**/*.*" (default)
diff --git a/node_modules/@cypress/code-coverage/support.js b/node_modules/@cypress/code-coverage/support.js
index c99ceb2..f51ce4e 100644
--- a/node_modules/@cypress/code-coverage/support.js
+++ b/node_modules/@cypress/code-coverage/support.js
@@ -37,7 +37,6 @@ const logMessage = (s) => {
  * If there are more files loaded from support folder, also removes them
  */
 const filterSupportFilesFromCoverage = (totalCoverage) => {
-  const integrationFolder = Cypress.config('integrationFolder')
   const supportFile = Cypress.config('supportFile')
 
   /** @type {string} Cypress run-time config has the support folder string */
@@ -50,16 +49,9 @@ const filterSupportFilesFromCoverage = (totalCoverage) => {
     isSupportFile(filename)
   )
 
-  // check the edge case
-  //   if we have files from support folder AND the support folder is not same
-  //   as the integration, or its prefix (this might remove all app source files)
-  //   then remove all files from the support folder
-  if (!integrationFolder.startsWith(supportFolder)) {
-    // remove all covered files from support folder
-    coverage = Cypress._.omitBy(totalCoverage, (fileCoverage, filename) =>
-      filename.startsWith(supportFolder)
-    )
-  }
+  coverage = Cypress._.omitBy(totalCoverage, (fileCoverage, filename) =>
+    filename.startsWith(supportFolder)
+  )
   return coverage
 }
 

This issue body was partially generated by patch-package.

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.