Resolve "Set Karma coverage threshold"
Closes #1335 (closed)
The following numbers are based on the most recent commit fc532ff5 (October 29, 2024 at 1:11pm)
GitLab pipeline output:
=============================== Coverage summary ===============================
Statements : 35.66% ( 3021/8470 )
Branches : 22.78% ( 541/2374 )
Functions : 27.32% ( 723/2646 )
Lines : 36.01% ( 2689/7466 )
================================================================================
But running ng test
locally sometimes gives different results. Possible reasons:
- Test order of execution.
- Re-runs of the tests may use cached results instead of calculating everything from scratch.
ng cache clear
and/or deleting the.angular
folder didn't produce the same result as the GL pipeline, though.
I haven't been able to pinpoint what the problem is exactly.
After running ng test
locally about 10 times, with and without clearing the cache in between, this is the lowest result I have found:
=============================== Coverage summary ===============================
Statements : 35.58% ( 3014/8470 )
Branches : 22.78% ( 541/2374 )
Functions : 27.17% ( 719/2646 )
Lines : 35.93% ( 2683/7466 )
================================================================================
This is without clearing the cache first, which I think is a more realistic scenario for developing, since clearing the cache makes the tests take longer. So I propose this as a baseline for future code coverage.