Closed kmerfeld closed 2 years ago
What tool are you using to generate that lcov.info file?
The lines starting with SF
in the lcov.info file are supposed to be absolute paths to the originating souce file. Is this not the case for you?
I'm using nyc/babel-plugin-istanbul
In the lcov.info file it doesn't have the /.coverage/ path
SF:src/app.js
OK, that is not an absolute path which I assumed when I wrote the parser.
According to the istanbul docs here https://istanbul.js.org/docs/advanced/alternative-reporters/#lcovonly , the lcov.info file should have the SF lines like
SF:$PROJECT_PATH/src/bar/index.ts
So is this a configuration problem on your end?
I don't do any JS coding, so I wont be able to set up any test projects. I also do not know the ecosystem, but maybe you know which project could answer why the paths are not absolute?
I have an idea that might work, but I would like to know how you find the lcov.info
file from your source files.
your right, this is nyc doing something weird https://github.com/istanbuljs/nyc/issues/1277
Thanks for helping me find this!
Just so I do not forget:
My idea was, that if I from /some/project/containing/source.js
find /some/project/unrelated/lcov.info
and the SF
entries in that file are relative it should be possible to find SF
entries that match the end of the source file path; containing/source.js
in this case. It is then possible to determine that the "project root" for lcov.info should be /some/project
. Each source file referenced by lcov.info then has to be prefixed by this path in the cov data structures.
But it should be noted that the lcov docs clearly states that the SF
entries should be absolute paths.
in cov--lcov-parse I need to add the following to get this working
my lcov.info file is in $projectroot/.coverage/lcov.info each path in cov-coverages was getting /.coverage/ in it
I don't really understand why this is happening, do you have any insight?
Thanks for your work on this project!