@cypress/code-coverage attempts to collect back-end coverage when we are not running end-to-end tests
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- cypress, typescript
- Ambito
- testing-qa
Direzione di ricerca
La issue indica support.js alle righe 168-172 e propone PR #474; inizia esaminando quella logica e la configurazione esistente expectBackendCoverageOnly. Verifica il comportamento delle integration specs quando expectFrontendCoverageOnly è abilitato, preservando al contempo il comportamento end-to-end attuale. Il lavoro è completato quando il plugin non tenta di accedere all'URL /coverage mancante in questo caso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Logs and screenshots
code-coverage combined NYC options { 'report-dir': './coverage', reporter: [ 'lcov', 'json-summary', 'text', 'cobertura' ], extension: [ '.jsx', '.js' ], excludeAfterRemap: false, sourceMap: false, instrument: false } +0ms
code-coverage reset code coverage in interactive mode +0ms
code-coverage reset code coverage in interactive mode +2s
code-coverage parsed sent coverage +8s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +30ms
code-coverage parsed sent coverage +721ms
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/
code-coverage parsed sent coverage +2s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +61ms
code-coverage parsed sent coverage +915ms
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +54ms
code-coverage parsed sent coverage +799ms
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +57ms
code-coverage parsed sent coverage +3s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +50ms
code-coverage parsed sent coverage +2s
code-coverage wrote coverage file /Users/nyee2/dev/plugins/campaign-manager-web-plugin/.nyc_output/out.json +53ms
Versions
- @cypress/code-coverage v3.9.7
- Cypress 7.0.1
- OS: MacOS Big Sur 11.4
- shell: bash
- Node v14.16.0
- NPM 6.14.11
- How do you instrument your application?
babel-plugin-istanbul - do you see
window.__coverage__object? yes,window.__coverage__exists and instrumentation works - Is there
.nyc_outputfolder? yes coverage data is generated - custom NYC settings in
package.json
"nyc": {
"extension": [
".jsx",
".js"
],
"reporter": [
"lcov",
"json-summary",
"text",
"cobertura"
],
"sourceMap": false,
"instrument": false
},
- Do you run Cypress tests in a Docker container? yes in CI, MacOS locally
Describe the bug
The logic to determine if cypress is running an "end-to-end" test incorrectly resolves as true in my cypress tests, as our baseUrl and proxyUrl are different.
Code reference in question:
https://github.com/cypress-io/code-coverage/blob/c51751f9f9875c88aaacf648c738bec63b4163f1/support.js#L168-L172
From the above code, runningEndToEndTests evaluates to true if your baseUrl and proxyUrl are different, which they are in my case but I am not running end-to-end tests.

As my specType is integration, after tests complete an attempt is made to reach a /coverage URL which does not exist, thus failing the test.

I would like to propose perhaps setting & checking against a new config codeCoverage.expectFrontendCoverageOnly explicitly to determine if backend coverage needs to be collected (similar to the pre-existing expectBackendCoverageOnly config), eg. the above code reference could be augmented to preserve the existing behavior but allowing an explicit check against expectFrontendCoverageOnly
const runningEndToEndTests = baseUrl !== Cypress.config('proxyUrl')
const specType = Cypress._.get(Cypress.spec, 'specType', 'integration')
const isIntegrationSpec = specType === 'integration'
const expectFrontendCoverageOnly = Cypress._.get(Cypress.env('codeCoverage'), 'expectFrontendCoverageOnly',
false)
if (!expectFrontendCoverageOnly && runningEndToEndTests && isIntegrationSpec) {
Link to the repo
The code I am using @cypress/code-coverage is behind a private GH instance so I unfortunately can't share here. I have created https://github.com/cypress-io/code-coverage/pull/474 with the above suggestion
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cypress-io/code-coverage
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 40/100
cypress-io/code-coverage#1018 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
cypress-io/code-coverage#993 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
cypress-io/code-coverage#967 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
cypress-io/code-coverage#959 ·
I maintainer di solito rispondono entro 1 giorno
-
performance
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
cypress-io/code-coverage#933 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cypress-io/code-coverage
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
hugomrdias/playwright-test#753 ·
I maintainer di solito rispondono entro 1 giorno
-
Review view: Daily/Weekly Review header buttons use the app-wide toolbar control styleForse già presa @colherdesopa l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
dongdongbh/Mindwtr#1515 ·
I maintainer di solito rispondono entro 1 giorno
-
pending-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
kirodotdev/Kiro#12301 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100