@@ -112,6 +112,9 @@ public class CoverageMeasuresStep implements ComputationStep { | |||
@Override | |||
public void visitFile(Component file) { | |||
if (file.getFileAttributes().isUnitTest()) { | |||
return; | |||
} | |||
try (CloseableIterator<ScannerReport.LineCoverage> lineCoverage = reportReader.readComponentCoverage(file.getReportAttributes().getRef())) { | |||
int linesToCover = 0; | |||
int coveredLines = 0; |
@@ -199,7 +199,7 @@ public class NewCoverageMeasuresStep implements ComputationStep { | |||
@Override | |||
public void initialize(CounterInitializationContext context) { | |||
Component component = context.getLeaf(); | |||
if (component.getType() != Component.Type.FILE) { | |||
if (component.getType() != Component.Type.FILE || component.getFileAttributes().isUnitTest()) { | |||
return; | |||
} | |||
Optional<Set<Integer>> newLinesSet = newLinesRepository.getNewLines(component); |
@@ -134,7 +134,7 @@ public class DefaultCoverage extends DefaultStorable implements NewCoverage { | |||
@Override | |||
public void doSave() { | |||
validateFile(); | |||
if (!isExcluded()) { | |||
if (!isExcluded() && inputFile.type() != InputFile.Type.TEST) { | |||
storage.store(this); | |||
} | |||
} |
@@ -249,7 +249,7 @@ public class GenericCoverageReportParserTest { | |||
private DefaultInputFile setupFile(String path) { | |||
return new TestInputFileBuilder(context.module().key(), path) | |||
.setLanguage("bla") | |||
.setType(InputFile.Type.TEST) | |||
.setType(InputFile.Type.MAIN) | |||
.initMetadata("1\n2\n3\n4\n5\n6") | |||
.build(); | |||
} |