Coder Social home page Coder Social logo

Comments (17)

JaKXz avatar JaKXz commented on August 15, 2024 2

I would change it to c8 --reporter=lcov npm test && npx codecov -- without any options codecov expects the coverage file to be in ./coverage/lcov.info. With this reporter you get the html report and the codecov file that you need. You can take a look at the nyc instructions here: https://istanbuljs.github.io/nyc/setup-codecov

from c8.

styfle avatar styfle commented on August 15, 2024 2

@bcoe Same problem

==> Detecting CI Provider
    Circle CI Detected
==> Configuration: 
    Endpoint: https://codecov.io
{ commit: '4830f0c24a845a6fbf8b4f5f32848c3be50811e0',
  branch: 'circleci',
  package: 'node-v3.3.0' }
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ find /home/circleci/repo -type f -name '*.gcno'  -exec gcov  {} +
==> Scanning for reports
    X Failed to read file at 
==> Uploading reports
    Success!
    View report at: https://codecov.io/github/zeit/tracing-js/commit/4830f0c24a845a6fbf8b4f5f32848c3be50811e0
Done in 10.34s.

image

from c8.

bcoe avatar bcoe commented on August 15, 2024 2

@styfle are you still having this problem? I believe I might have addressed it for our own use-cases at Google, I use this configuration:

{
  "report-dir": "./.coverage",
  "reporter": ["text", "lcov"],
  "exclude": [
    "**/*-test",
    "**/.coverage",
    "**/apis",
    "**/benchmark",
    "**/docs",
    "**/samples",
    "**/scripts",
    "**/src/**/v*/**/*.js",
    "**/test",
    ".jsdoc.js",
    "**/.jsdoc.js",
    "karma.conf.js",
    "webpack-tests.config.js",
    "webpack.config.js"
  ]
}

and run the codecov upload bin.

from c8.

nevir avatar nevir commented on August 15, 2024 1

It's working like a charm over here (private repo so I can't show the results).

Commands being run are:

c8 …run your tests… # We actually do this twice for two different test suites
c8 report --reporter=text-lcov > coverage/tests.lcov
codecov # it will discover lcov.info, as well as *.lcov files

from c8.

eight04 avatar eight04 commented on August 15, 2024

I have some projects using c8 + travis + codecov. However, it seems that the line number is wrong. Here is an example:
https://codecov.io/gh/eight04/idb-storage/src/master/index.js

from c8.

bcoe avatar bcoe commented on August 15, 2024

@eight04 @styfle this should work with codecov, try using -reporter=text-lcov for output? exactly the same as nyc.

from c8.

eight04 avatar eight04 commented on August 15, 2024

I have already used the text-lcov format in travis. Log:
https://travis-ci.com/eight04/idb-storage

c8 v3.4.0
https://github.com/eight04/idb-storage/blob/11d650c70da907e04971e76d0573588ce22a1d74/package.json#L30

from c8.

eight04 avatar eight04 commented on August 15, 2024

I made a PR updating c8 to 3.5.0, changing the format to lcov, and drop the c8 report command. The line number is corrected now:
https://codecov.io/gh/eight04/idb-storage/pull/5/src/index.js

Travis log:
https://travis-ci.com/eight04/idb-storage/builds/108787127

from c8.

styfle avatar styfle commented on August 15, 2024

It looks like c8 works fine because I get an html report I can view in my browser after running npx c8 --reporter=lcov npm test && npx codecov.

So there must be a bug in the codecov package because files upload successfully and a url is generated for the commit, but visiting the url says there was an error processing reports.

npx: installed 21 in 1.582s
  _____          _  
 / ____|        | |  
| |     ___   __| | ___  ___ _____   __  
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /  
| |___| (_) | (_| |  __/ (_| (_) \ V /  
 \_____\___/ \__,_|\___|\___\___/ \_/  
                                v3.3.0
==> Detecting CI Provider
    Circle CI Detected
==> Configuration: 
    Endpoint: https://codecov.io
{ commit: 'd9f760b1523acec516084cb0453ca824950f3f17',
  branch: 'circleci',
  package: 'node-v3.3.0' }
==> Building file structure
==> Generating gcov reports (skip via --disable=gcov)
    $ find /home/circleci/repo -type f -name '*.gcno'  -exec gcov  {} +
==> Scanning for reports
    + /home/circleci/repo/coverage/lcov.info
==> Uploading reports
    Success!
    View report at: https://codecov.io/github/zeit/tracing-js/commit/d9f760b1523acec516084cb0453ca824950f3f17
Done in 9.27s.

from c8.

bcoe avatar bcoe commented on August 15, 2024

@styfle did you try text-lcov like the nyc example.

from c8.

JaKXz avatar JaKXz commented on August 15, 2024

same problem

because text-lcov does not output the lcov.info file in the same place that the lcov reporter does.

from c8.

bcoe avatar bcoe commented on August 15, 2024

@styfle @JaKXz text-lcov outputs an lcov report to the terminal, which I believe s service like coveralls should then allow you to pipe to it; here's what I do with coveralls.io:

c8 report --reporter=text-lcov | coveralls"

It looks like maybe codecov only accepts an uploaded file? so I guess the original approach you were taking looks more reasonable.

I'd need to play with codecov.io's interface, but I'm 99% sure the lcov info being output is correct.

from c8.

bcoe avatar bcoe commented on August 15, 2024

anyone happen to have codecov configured, and want to try c8 out?

from c8.

styfle avatar styfle commented on August 15, 2024

@bcoe I'm not sure what file you posted above. Is this a c8 config file?

I tried the latest c8 and codecov cli via npx and it still fails. I suspect this is a problem with codecov because nyc also failed in the same way but their support has been busy for the last couple months 🤷‍♂

Can you see this script and this CI job?

I'm using npx c8 --reporter=lcov npm test && npx codecov.

from c8.

bcoe avatar bcoe commented on August 15, 2024

@styfle that is the .c8rc.json file, we use the public codecov bash script, with most of our libraries on github.com/googleapis, and it seems to work like a charm.

If you share a project with codecov failing, perhaps I could take a look. I also recommend opening an issue on codecov.

from c8.

styfle avatar styfle commented on August 15, 2024

@bcoe Thanks for the help, I appreciate it!

The project is here: https://github.com/zeit/tracing-js

from c8.

styfle avatar styfle commented on August 15, 2024

@bcoe I got it working by running tests with ts-node vercel/tracing-js#26

Here's the script I used:

npx c8 --reporter=lcov tape -r ts-node/register test/**.ts && npx codecov

from c8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.