MasterCoverageAction gets confused by node_modules/**/coverage.json
SpComb opened this issue · comments
Some yarn packages may ship coverage.json
files. These dependencies should not be considered in any coverage metrics:
bash-4.2# find . -name coverage.json
./node_modules/selenium-webdriver/node_modules/tmp/coverage/coverage.json
./node_modules/async-limiter/coverage/coverage.json
./node_modules/mocha-multi-reporters/artifacts/coverage/coverage.json
The MasterCoverageAction
step gets confused by these coverage.json
files, because they are not ruby SimpleCov files:
java.lang.IllegalArgumentException: Strange SimpleCov report!
Can't extract float value by JsonPath: $.metrics.covered_percent
from:
{"/Users/samuelreed/git/forks/async-throttle/index.js":{"path":"/Users/samuelreed/git/forks/async-throttle/index.js","s":{"1":1,"2":7,"3":1,"4":6,"5":6,"6":6,"7":6,"8":6,"9": ....}
at com.github.terma.jenkins.githubprcoveragestatus.SimpleCovParser.extractValueFromPath(SimpleCovParser.java:34)
at com.github.terma.jenkins.githubprcoveragestatus.SimpleCovParser.get(SimpleCovParser.java:26)
at com.github.terma.jenkins.githubprcoveragestatus.GetCoverageCallable.getFloats(GetCoverageCallable.java:49)
at com.github.terma.jenkins.githubprcoveragestatus.GetCoverageCallable.invoke(GetCoverageCallable.java:72)
at com.github.terma.jenkins.githubprcoveragestatus.GetCoverageCallable.invoke(GetCoverageCallable.java:32)
It does not seem to be possible to configure the search patterns for the various coverage files, which makes it seemingly impossible to ignore things like node_modules
files:
Workaround is to use disableSimpleCov: true
The pipeline step disableSimpleCov: true
didn't actually work, it's a global setting, not a pipeline step parameter:
08:43:47 WARNING: Unknown parameter(s) found for class type 'com.github.terma.jenkins.githubprcoveragestatus.MasterCoverageAction': disableSimpleCov
08:33:02 WARNING: Unknown parameter(s) found for class type 'com.github.terma.jenkins.githubprcoveragestatus.CompareCoverageAction': disableSimpleCov,jacocoCounterType
Unfortunately it doesn't look like configuration-as-code plugin supports this plugin's settings either :(
Dupe of #37, seems like the disableSimpleCov
flag is intended to fix this specific isuse.
Ideal fix would be to make the **/coverage.json
pattern configurable.