codecov-node icon indicating copy to clipboard operation
codecov-node copied to clipboard

--root command line argument doesn't parse path correctly

Open LachlanStuart opened this issue 6 years ago • 2 comments

--root and -p are documented to be the same option:

$ codecov --help

... --root, -p Project root, if not current directory ...

But according to the logs, only one of the two works as expected. See the "Upload Coverage" step in each of these links:

  • codecov -p .. -F webapp works as expected
  • codecov --root ../.. -F webapp fails to upload due to a JavaScript error. It looks like it's incorrectly parsing the arguments, because it mentions the path '/root/metaspace/metaspace/webapp/true'. /root/metaspace is the project root, /root/metaspace/metaspace/webapp is the current directory, but there is no true directory anywhere in that directory tree. It's as if something coerced the --root argument to a boolean before it was used.

I'm on version 3.0.4, installed through NPM and run on CircleCI without any codecov.yaml file.

LachlanStuart avatar Aug 07 '18 09:08 LachlanStuart

I notice with the -p it's just using the path as .., but with the --root it's using ../.. just wondering if that could be why. May need to put the root in quotes. codecov --root "../.." -F webapp

Let me know if that helps

eddiemoore avatar Aug 08 '18 05:08 eddiemoore

.. was a typo in my GitHub comment, I used ../.. in the linked logs. Even if I use a subdirectory (e.g. codecov --root src I got the same issue. Quotes did nothing. However I found that adding a = worked, e.g. codecov --root=src.

I think this might be a misconfiguration of yargs that has caused it to interpret --root as a boolean flag instead of expecting it to be followed with a value. I don't have any experience with yargs, but noticed that their docs don't list 'path' as a valid value for type, which may explain this behavior.

LachlanStuart avatar Aug 08 '18 12:08 LachlanStuart