最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - SonarQube and Karma code coverage - unresolved file paths - Stack Overflow

programmeradmin2浏览0评论

I searched a lot for this specific error, but I had no chance in finding a suitable answer.

I have SonarQube 5.4 and using newest Karma-version.

Following error occurs when running sonar-runner:

INFO: Analysing /Users/foo/repository/BarJS/test/reports/coverage/lcov.info
INFO: Could not resolve 6 file paths in lcov.info, first unresolved path: /Users/foo/repository/BarJS/test/spec/Classname.test.js

While foo is my username and BarJS is the name of the project.

Other people getting those errors having mispelled or case-specific or relative paths. I checked half a dozen times. My paths are correct.

I have absolute paths in my Karma lcov.info-file. All camelcase letters are equal to their path in Finder.

Content of Karmas lcov.info

SF:/Users/foo/repository/BarJS/test/spec/Classname.test.js

Anybody out there having same issue? It is really annoying

I searched a lot for this specific error, but I had no chance in finding a suitable answer.

I have SonarQube 5.4 and using newest Karma-version.

Following error occurs when running sonar-runner:

INFO: Analysing /Users/foo/repository/BarJS/test/reports/coverage/lcov.info
INFO: Could not resolve 6 file paths in lcov.info, first unresolved path: /Users/foo/repository/BarJS/test/spec/Classname.test.js

While foo is my username and BarJS is the name of the project.

Other people getting those errors having mispelled or case-specific or relative paths. I checked half a dozen times. My paths are correct.

I have absolute paths in my Karma lcov.info-file. All camelcase letters are equal to their path in Finder.

Content of Karmas lcov.info

SF:/Users/foo/repository/BarJS/test/spec/Classname.test.js

Anybody out there having same issue? It is really annoying

Share Improve this question asked Apr 27, 2016 at 23:44 dazliousdazlious 5566 silver badges23 bronze badges 5
  • Do you import this file into SQ? – Elena Vilchik Commented Apr 28, 2016 at 16:33
  • Yeah, but not manually. I use sonar.properties in my project folder with this argument: sonar.javascript.lcov.reportPath – dazlious Commented Apr 29, 2016 at 8:07
  • Sorry, I was meaning file "Classname.test.js" – Elena Vilchik Commented Apr 29, 2016 at 14:47
  • 1 do you have "/Users/foo/repository/BarJS/test/spec/Classname.test.js" included in "sonar.sources"? – Elena Vilchik Commented May 2, 2016 at 14:24
  • @ElenaVilchik: No, not included. There is only reference to my JS files, not my tests – dazlious Commented May 4, 2016 at 10:57
Add a ment  | 

2 Answers 2

Reset to default 2

In my case, the solution was to add

sonar.tests=test/spec 

to my sonar.properties. Now it is working like a charm

@ElenaVilchik: many thx for your direction, helped a lot

I also had the same issue. Sonar scanner log shows first unresolved path: ./app/modules/abc.js as the error. The reason for my issue was, my sonar-project.properties file was in a parent directory rather than app folder. I could be able to solve the issue by changing the directory paths in lcov.info file to relative paths from the directory which is sonar-project.properties resides.

ex: sonar-project.properties file was in a folder called WebContent. lcov.info file shows SF:./app/modules/abc.js as file path. After changing this to SF:./WebContent/app/modules/abc.js, test result published to sonar without any issue.

发布评论

评论列表(0)

  1. 暂无评论