istanbul
istanbul copied to clipboard
Add relative option to lcov format files.
When using coverage with lcov files, reports are created using absolute paths.
There is a good reason to want to generate the report using relative paths. This is both for security reasons and when using an external service in another location such as SonarQube in long delivery pipelines.
This PR offers the option to create the reports with relative paths, this option is turned off by default.
Refers to #104
Looking forward to seeing this released. It'll clean up the need to do post-processing on the generated lcov file.
I have a real need for this as well. I hope to see it merged soon.
Hi, is there any update as to when this is likely to be released, we're having issues with sonarqube and istanbul because of absolute vs relative paths ?
As a workaround I'm using sed to modify the file after it's been generated. Something like this:
# convert absolute paths to relative before sonar runs
sed -i 's|SF:/part_of_path_i_want_to_go_away/|SF:|g' coverage/report-lcov/lcov.info
You are the man, that’s been driving me insane all week ☺ Any plans to implement a permanent solution ?
From: titocr [email protected] Reply-To: gotwarlost/istanbul [email protected] Date: Thursday, 7 September 2017 at 23:39 To: gotwarlost/istanbul [email protected] Cc: Tim Heap [email protected], Manual [email protected] Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
As a workaround I'm using sed to modify the file after it's been generated. Something like this:
convert absolute paths to relative before sonar runs
sed -i 's|SF:/part_of_path_i_want_to_go_away/|SF:|g' coverage/report-lcov/lcov.info
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gotwarlost/istanbul/pull/771#issuecomment-327945992, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGqbywr8S63WDYxEKC8o4coNUWWDekUCks5sgHCkgaJpZM4MPWw5.
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
Glad to help. As for a permanent fix, as I understand it, it's sitting here with the commit @miguelrincon did. I'm just waiting on it like everyone else ;-)
Yes I saw that post ☺
From: titocr [email protected] Reply-To: gotwarlost/istanbul [email protected] Date: Saturday, 9 September 2017 at 18:06 To: gotwarlost/istanbul [email protected] Cc: Tim Heap [email protected], Manual [email protected] Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Glad to help. As for a permanent fix, as I understand it, it's sitting here with the commit @miguelrinconhttps://github.com/miguelrincon did. I'm just waiting on it like everyone else ;-)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gotwarlost/istanbul/pull/771#issuecomment-328290494, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGqby8VRQnSiCvukEP8ZROXpyE5K9Rlrks5sgsWfgaJpZM4MPWw5.
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
Hi, still struggling with getting this working on CI. If I have a file called lcov.info which contains this line : SF:deploy/app/shared/services/sharedServicesModule.js
And I simply want to remove the deploy/ part so it becomes SF:app/shared/services/sharedServicesModule.js then this should work, right ?
sed -i 's|SF:deploy/|SF:|g'
From: titocr [email protected] Reply-To: gotwarlost/istanbul [email protected] Date: Saturday, 9 September 2017 at 18:06 To: gotwarlost/istanbul [email protected] Cc: Tim Heap [email protected], Manual [email protected] Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Glad to help. As for a permanent fix, as I understand it, it's sitting here with the commit @miguelrinconhttps://github.com/miguelrincon did. I'm just waiting on it like everyone else ;-)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gotwarlost/istanbul/pull/771#issuecomment-328290494, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGqby8VRQnSiCvukEP8ZROXpyE5K9Rlrks5sgsWfgaJpZM4MPWw5.
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
Our CI is jenkins and this is the line I use (changed only the last part of the path). I had to try a couple different things before discovering what path was needed.
sed -i 's|SF:/opt/jenkins/workspace/myProject/|SF:|g' coverage/report-lcov/lcov.info
An altered line in lcov.info, before and after:
SF:/opt/jenkins/workspace/myProject/src/app/config/app_config.js
SF:src/app/config/app_config.js
Hope that helps.
Thanks I have this working now.
From: titocr [email protected] Reply-To: gotwarlost/istanbul [email protected] Date: Monday, 11 September 2017 at 15:59 To: gotwarlost/istanbul [email protected] Cc: Tim Heap [email protected], Manual [email protected] Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Our CI is jenkins and this is the line I use (changed only the last part of the path). I had to try a couple different things before discovering what path was needed.
sed -i 's|SF:/opt/jenkins/workspace/myProject/|SF:|g' coverage/report-lcov/lcov.info
An altered line in lcov.info, before and after:
SF:/opt/jenkins/workspace/myProject/src/app/config/app_config.js SF:src/app/config/app_config.js
Hope that helps.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gotwarlost/istanbul/pull/771#issuecomment-328556689, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGqby67cPJIEaRtInSBNN3rwyys80LJ-ks5shUq9gaJpZM4MPWw5.
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
Hi, does Istanbul run on windows for c sharp code , and if not are there any plans for it in the future ? looking at ways of surfacing code coverage with sonarqube for some of our projects.
From: titocr [email protected] Reply-To: gotwarlost/istanbul [email protected] Date: Monday, 11 September 2017 at 15:59 To: gotwarlost/istanbul [email protected] Cc: Tim Heap [email protected], Manual [email protected] Subject: [EXTERNAL] Re: [gotwarlost/istanbul] Add relative option to lcov format files. (#771)
Our CI is jenkins and this is the line I use (changed only the last part of the path). I had to try a couple different things before discovering what path was needed.
sed -i 's|SF:/opt/jenkins/workspace/myProject/|SF:|g' coverage/report-lcov/lcov.info
An altered line in lcov.info, before and after:
SF:/opt/jenkins/workspace/myProject/src/app/config/app_config.js SF:src/app/config/app_config.js
Hope that helps.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gotwarlost/istanbul/pull/771#issuecomment-328556689, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGqby67cPJIEaRtInSBNN3rwyys80LJ-ks5shUq9gaJpZM4MPWw5.
This message is intended for the stated addressee(s) only and may be confidential. Access to this email by anyone else is unauthorised. Any opinions expressed in this email do not necessarily reflect the opinions of BGL Group Limited and its subsidiaries . Any unauthorised disclosure, use or dissemination, either whole or in part is prohibited. If you are not the intended recipient of this message, please notify the sender immediately.
Please scan all attachments for viruses.
I would love to see this merged. Our build pipeline includes running tests on one docker container and using instanbul to report coverage in another machine using sonarqube.
We really need this option.
Would also like this change
any idea if this is likely to happen any time soon ?
Looks like this repository has been deprecated, nyc is the replacement for this tool, but it too, does not support relative paths.
So I've solved this for myself like some others in this thread with sed
, however instead of making the path relative, just encase that brakes something else, I update the path to be absolute to the current directory with sed -i "s|SF:/app|SF:$(pwd)|g" lcov.info
In a Typescript Angular 6 project I needed to make the path to be that of the Docker image used for the sonar-scanner. Since the path could change in the build pipeline (BitBucker) I used the following sed expression:
sed -i "s|SF:/.*/my-project/|SF:/root/src/|g" test-reports/lcov.info
where /root/src is the name of the mapped folder of the current folder in the Docker container that was started by the following command:
docker run -ti -v $(pwd):/root/src newtmitch/sonar-scanner
This is such a small change. What's the blocker? Lack of maintainers?
Hey, it would be a very useful change, what is blocking ?
I would love to see this merged too !
Anything new for this PR ? It would be really useful to have this option !
It's not that I don't like sed
but... 😅
2 years and still not merged 🤦♂️
What's stopping this from being merged? I really need this feature.
Someone really enjoys using sed and hacks... :(
On Github (with actions), I successfully used sed -i "s|SF:/.*/src/|SF:/github/workspace/src/|g" coverage/lcov.info
Thank you @ozoli
I've put a hack for this in our CI in 2017, it's still an issue now...
I've added the sed
hack as well, but it'd be nice to get this merged...
I'd really like to have this 2-year old (and counting) much needed fix to be merged, also! Any way to speed that up?
When will this be merged, it's been more than 2 years ?
3+ years and finally approved, Please merge it in
I started to use sed
as a work-around and this is approved. lol