mweibel / lcov-result-merger

Merges multiple lcov results into one
MIT License
102 stars 22 forks source link

Empty file when merging lcov.files #55

Open migheorghe opened 1 year ago

migheorghe commented 1 year ago

For some reasone version 4 does not output anything when run like bellow: V4.0.0 - npx lcov-result-merger "C:\temp\CodeCoverage**\lcov.info" "C:\Temp\CodeCoverage\lcov.info"

version 3.3.0 works as expected npx lcov-result-merger@3.3.0 "C:\temp\CodeCoverage**\lcov.info" "C:\Temp\CodeCoverage\lcov.info"

yuriy-yarosh commented 1 year ago

@migheorghe It's overwriting the original files, prepending the path over and over with the --prepend-source-files arg.

I'm using it as a yarn bin instead of a yarn script, and it's the only way it works, for some reason.

yarn coverage && yarn lcov-result-merger **/coverage/lcov.info lcov.info --prepend-source-files

There should be some kind of pwd bug, when it can't switch to the root folder of a monorepo.

I migh refactor this project a bit, and provide a bit more decent replacement, in the future.

mweibel commented 1 year ago

@mdeanjones any idea here?

mdeanjones commented 1 year ago

Nothing at present @mweibel. I'll be closing out some other work in the next couple of weeks, and plan on digging into this.

@yuriy-yarosh refactors are welcome! There's a lot that I've been eyeing too.

mdeanjones commented 1 year ago

Following up on this @migheorghe. v5.0.0-rc.0 has just been released which may contain a fix for the problem that you are experiencing. Prior versions were creating a temp file named lcov.info in the working directory that might be clobbering things for you.

OLD https://github.com/mweibel/lcov-result-merger/blob/5aa886dddcf8a3451459ced80ae6d63666b986b6/index.js#L104-L107

With this release, that temp file is being created in the OS' temp space, so it should never collide.

NEW https://github.com/mweibel/lcov-result-merger/blob/6cd3b2184716fc5505bbff7f8a5f465ca7da6263/index.js#L96-L101

I think that we can move even further and eliminate using temp files altogether... more refactors incoming.

carboni-rob commented 11 months ago

I seem to be still experiencing this on 5.0.0.

carboni-rob commented 11 months ago

Tbh, I don't seem to be able to make any combination of versions/commands/options work. The files are picked up, but lines, functions and branches are all 0/0.

mdeanjones commented 10 months ago

@carboni-rob, would you be able to create a minimal reproduction of your issue, or furnish a sample file that is failing to be read?

Initial thoughts:

  1. Line breaks aren't being handled correctly when parsing files.
  2. Something that is somehow tied into #58

Happy holidays!