我在我的 JavaScript 单元测试中使用 karma-coverage 和 isparta-loader 来生成lcov.info
文件。
但是,当我使用JavaScript Plugin运行 SonarQube 分析时,不会生成测试覆盖率报告。如果lcov.info
包含 1 个文件的数据,则覆盖率报告不会失败,但如果lcov.info
包含 2 个或更多文件的数据,则始终失败:
13:43:27.635 信息 - 将结果存储在数据库中 13:43:27.649 调试 - 执行 org.sonar.batch.phases.GraphPersister 13:43:27.714 调试 - 执行 org.sonar.batch.index.SourcePersister 13:43:29.852调试 - 在项目上发布信号量:org.sonar.api.resources.Project@6b1e6f8b[id=7859,key=func.salesorder NG,qualifier=TRK],关键是 batch-func.salesorderNG 信息:------ -------------------------------------------------- ---------------- 信息:执行失败信息:---------------------------- -------------------------------------------- 总时间:4:14.804 s 最终内存:23M/828M 信息:---------------------------------------- --------------------------
错误:Sonar runner 执行期间出错
org.sonar.runner.impl.RunnerException:无法在 org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) 在 org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher. java:75) 在 java.security.AccessController.doPrivileged(Native Method) 在 org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) 在 org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher. java:50) 在 org.sonar.runner.api.Runner.execute(Runner.java:100) 在 org.sonar.runner.doExecute(EmbeddedRunner.java:102) 在 org.sonar.runner.Main .executeTask(Main.java:70) at org.sonar.runner.Main.execute(Main.java:59) at org.sonar.runner.Main.main(Main.java:53) 原因:java.lang。IllegalStateException:无法在 org.sonar.batch.phases.DatabaseModePhaseExecutor.executePersisters(DatabaseModePhaseExecutor.java:165) 在 org.sonar 的 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:84) 保存文件源。 batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:133) 在 org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264) 在 org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java: 92) 在 org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) 在 org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235) 在 org.sonar.batch.scan.ProjectScanContainer .scanRecursively(ProjectScanContainer.java:230) 在 org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 在 org.sonar.api.platform 的 org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220) .ComponentContainer.execute(ComponentContainer.java:77) 在 org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57) 在 org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45) 在org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135) 在 org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 在 org.sonar.api.platform.ComponentContainer.execute( org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java: 的 ComponentContainer.java:77)158)在 org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) 在 org.sonar.runner.Batch.IsolatedLauncher 的 org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95) .execute(IsolatedLauncher.java:48) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 在 java.lang。 reflect.Method.invoke(Unknown Source) at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) ... 9 更多原因:java.lang.ArrayIndexOutOfBoundsException:java.util 中的 -1。 java.util.ArrayList 中的 ArrayList.elementData(未知来源)。get(Unknown Source) at com.google.protobuf.RepeatedFieldBuilder.getBuilder(RepeatedFieldBuilder.java:245) at org.sonar.server.source.db.FileSourceDb$Data$Builder.getLinesBuilder(FileSourceDb.java:2911) at org. sonar.batch.index.SourceDataFactory.applyLineMeasure(SourceDataFactory.java:183) 在 org.sonar.batch.index.SourceDataFactory.applyLineMeasures(SourceDataFactory.java:117) 在 org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory. java:76) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index 的 org.sonar.batch.index.SourcePersister.computeData(SourcePersister.java:152) .SourcePersister.persist(SourcePersister.java:81) ... 33 更多org.sonar.server.source.db.FileSourceDb$Data$Builder.getLinesBuilder(FileSourceDb.java:2911) 上的 RepeatedFieldBuilder.getBuilder(RepeatedFieldBuilder.java:245) java:183) 在 org.sonar.batch.index.SourceDataFactory.applyLineMeasures(SourceDataFactory.java:117) 在 org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76) 在 org.sonar.batch.index .SourcePersister.computeData(SourcePersister.java:152) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) 。 .. 还有 33 个org.sonar.server.source.db.FileSourceDb$Data$Builder.getLinesBuilder(FileSourceDb.java:2911) 上的 RepeatedFieldBuilder.getBuilder(RepeatedFieldBuilder.java:245) java:183) 在 org.sonar.batch.index.SourceDataFactory.applyLineMeasures(SourceDataFactory.java:117) 在 org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76) 在 org.sonar.batch.index .SourcePersister.computeData(SourcePersister.java:152) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) 。 .. 还有 33 个server.source.db.FileSourceDb$Data$Builder.getLinesBuilder(FileSourceDb.java:2911) 在 org.sonar.batch.index.SourceDataFactory.applyLineMeasure(SourceDataFactory.java:183) 在 org.sonar.batch.index.SourceDataFactory。 applyLineMeasures(SourceDataFactory.java:117) at org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76) at org.sonar.batch.index.SourcePersister.computeData(SourcePersister.java:152) at org.sonar .batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) ... 33 更多server.source.db.FileSourceDb$Data$Builder.getLinesBuilder(FileSourceDb.java:2911) 在 org.sonar.batch.index.SourceDataFactory.applyLineMeasure(SourceDataFactory.java:183) 在 org.sonar.batch.index.SourceDataFactory。 applyLineMeasures(SourceDataFactory.java:117) at org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76) at org.sonar.batch.index.SourcePersister.computeData(SourcePersister.java:152) at org.sonar .batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) ... 33 更多183)在 org.sonar.batch.index.SourceDataFactory.applyLineMeasures(SourceDataFactory.java:117) 在 org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76) 在 org.sonar.batch.index.SourcePersister .computeData(SourcePersister.java:152) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) ...还有 33 个183)在 org.sonar.batch.index.SourceDataFactory.applyLineMeasures(SourceDataFactory.java:117) 在 org.sonar.batch.index.SourceDataFactory.consolidateData(SourceDataFactory.java:76) 在 org.sonar.batch.index.SourcePersister .computeData(SourcePersister.java:152) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) ...还有 33 个persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) ... 还有 33 个persist(SourcePersister.java:93) 在 org.sonar.batch.index.SourcePersister.persist(SourcePersister.java:81) ... 还有 33 个
显示lcov.info
以下信息:
SF:D:\SOC\src\UI\UI.ng\js\general\services\tabStateService.js
FN:3,_interopRequireDefault
FN:11,(anonymous_2)
FN:14,tabStateService
FN:17,moveNext
FNF:4
FNH:4
FNDA:1,_interopRequireDefault
FNDA:1,(anonymous_2)
FNDA:21,tabStateService
FNDA:2,moveNext
DA:0,1
DA:1,1
DA:4,1
DA:5,1
DA:8,1
DA:9,21
DA:10,21
DA:12,2
LF:8
LH:8
BRDA:3,1,0,0
BRDA:3,1,1,1
BRDA:3,2,0,1
BRDA:3,2,1,1
BRF:4
BRH:4
end_of_record
TN:
SF:D:\SOC\src\UI\UI.ng\js\general\services\pagingService.js
FN:5,(anonymous_1)
FN:8,pagingService
FN:14,getPagingParams
FN:20,calculateSkip
FNF:4
FNH:4
FNDA:1,(anonymous_1)
FNDA:23,pagingService
FNDA:11,getPagingParams
FNDA:7,calculateSkip
DA:1,1
DA:3,1
DA:4,1
DA:7,1
DA:9,23
DA:13,1
DA:14,11
DA:15,2
DA:16,9
DA:17,7
DA:18,2
DA:21,1
DA:22,7
LF:13
LH:13
BRDA:15,1,0,2
BRDA:15,1,1,9
BRDA:15,2,0,11
BRDA:15,2,1,9
BRDA:16,3,0,7
BRDA:16,3,1,2
BRDA:16,4,0,9
BRDA:16,4,1,7
BRF:8
BRH:8
end_of_record