Bootloader code is not covered: the app boots before the coverage interceptor
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Read src/Stage.php and src/Internal/Interceptor/BootInterceptor.php, then compare the boot interceptor order with Testo's InterceptorOptions::ORDER_COVERAGE. Reproduce with a package test case extending Spiral\Testing\TestCase and a bootloader in defineBootloaders(), collecting line coverage or Infection results. Done when bootloader init()/boot() lines are attributed to each test and their mutants are included in mutation testing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
With spiral/testing 4.x the application boots outside Testo's coverage window, so code run in bootloader init()/boot() is not credited to any test. In spiral-packages/symfony-validator, migrating the Functional suite from a hand-rolled kernel (booted in the test body via #[BeforeTest]) to Spiral\Testing\TestCase dropped line coverage from 99/99 to 92/99: the missing lines are all in ValidatorBootloader. Infection is affected silently: it generated 50 mutants instead of 53 (the bootloader lines have no covering test, so their mutants are never produced) and still reported 100% MSI.
The cause is interceptor order. BootInterceptor runs at Stage::BOOT = 300_000 (src/Stage.php#L27, src/Internal/Interceptor/BootInterceptor.php#L18), while the coverage interceptor sits at InterceptorOptions::ORDER_COVERAGE = 1_001_000_000 (testo core/Pipeline/Attribute/InterceptorOptions.php#L51), i.e. inner to the boot. Everything the app does while booting happens before coverage collection starts.
Steps to reproduce
- A package test suite extending
Spiral\Testing\TestCase, with the package bootloader indefineBootloaders(). - Run Testo with coverage (or Infection via testo/bridge-infection).
- The bootloader's
init()/boot()lines are reported as uncovered, although every test boots them.
Workaround: call $this->initApp() inside the test body; the second boot runs inside the coverage window.
Proposed solution
Make the boot visible to coverage, e.g. by booting inside the coverage window (an order inner to ORDER_COVERAGE) or by attributing the boot to the test some other way. A boot that runs once per test should count as that test's coverage, otherwise mutation testing silently loses mutants instead of reporting them as uncovered.
- Lingua principale
- PHP
- Stelle
- 7
- Fork
- 7
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la 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 spiral/testing
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Add support for parallel testingForse di nuovo libera @butschster l’ha presa 1112 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
-
Test core interceptorsApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
-
Remake auth testingForse di nuovo libera @butschster l’ha presa 1409 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
Tutte le issue di spiral/testing
Issue simili
-
area/import type/enhancement when/later
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
parime/glpi-iso27001-management#1165 ·
I maintainer di solito rispondono entro 1 giorno
-
15.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
opnsense/plugins#5976 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100