Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path in lcov report is incorrect #31

Closed
nerdgore opened this issue Apr 14, 2015 · 5 comments
Closed

Path in lcov report is incorrect #31

nerdgore opened this issue Apr 14, 2015 · 5 comments

Comments

@nerdgore
Copy link

I would expect the paths in the lcov report (and all other reports) to be relative to the root folder I define in the config.
My file structure looks like this:

|-libs
| |-app.js
| |-util.js

I would expect that the lcov output looks somewhat like this:
SF:libs/app.js
However, I get this:
SF:/Users/username/workspace/myprojects/my_fancy_project/libs/app.js

Am I missing something or is this the expected behaviour?

For reference, this is what I have in my gruntfile.js.

options: {
    coverage: true,
    coverageFolder: "reports",
    reportFormats: ["text", "cobertura", "lcovonly"],
    require: "should",
    root: "./"
}
@pocesar
Copy link
Owner

pocesar commented Apr 14, 2015

does it change if you set root to '.' or './libs'? the full path shouldn't be inside the lcov, it seems to have been fixed by istanbul a while ago according to gotwarlost/istanbul#104

@nerdgore
Copy link
Author

It seems I should have read the lcov spec beforehand.
I was expecting the path to be relative to the root, however it seems this only controls which files are instrumented and that the absolute path in the report is correct.

@pocesar
Copy link
Owner

pocesar commented Apr 15, 2015

alright, I didn't even know that, thanks for clearing out

@pocesar pocesar closed this as completed Apr 15, 2015
@vptech20nn
Copy link

Is there a option which will allow us to choose relative or absolute path ? I am getting absolute paths.

@RobotLimeLtd
Copy link

I would also like to know if there's an option - I'm trying to get two projects to work with SonarQube, one is producing relative paths in lcov.info, the other absolute paths. I can't tell what difference is causing this.

I generally build NPM in a separate build stage to running Sonar tests. This allows me to get instant unit test failure feedback more quickly. During the 1st build job, I zip up enough of the local directory to run Sonar and pull that into the next stage. The problem with absolute paths is that they point to the build directory of a different job, and are thus invalid in the new job!

I can work around this with a nasty sed hack, but I'd rather find out what change I can make to the karma conf file to choose relative paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants