mocha-lcov-reporter for LCOV coverage from Mocha

Steven July 28, 2013 11:03

A while ago I wrote a LCOV reporter for Mocha. Mocha is a unit test framework for JavaScript. LCOV is a format to store line coverage. Back then, I even wrote a post about it.

At the time I was working on several JavaScript libraries and programs. For most of these projects I used Mocha for unit testing. Also, I was using SonarQube (called SonarSource back then) to monitor my projects, code-wise, using the JavaScript plugin for SonarQube.

Because the Javascript plugin for SonarQube had support for coverage data in the LCOV format, I started looking for ways to get the test coverage into SonarQube. Unfortunately, Mocha had no LCOV reporter, but had some other reporters. I created a pull request to add a new reporter to Mocha. Fortunately, TJ Holowaychuk did not accept the pull request but made it possible to write and use reporters from separate packages. This way, Mocha would not be polluted with many different kinds of reporters and saving him work due to possible bugs in those reporters and the many pull requests to come for additional reporters.

Last week I came across the mocha-lcov-reporter package at the Node Packaged Modules repository. Turns out, the package is downloaded fairly often! The stats for today (28th of july, 2013):

  • 121 downloads in the last day;
  • 1102 downloads in the last week;
  • 3844 downloads in the last month.

I’m enthusiastic about how often this package is used! Makes me wonder who is using the packages for which projects, and how often it is used.

Comments

  • Gavin says:

    Hey there, im one of the users of this package, i use it with istanbul and coveralls to get a great summary of code coverage. Im insterested in doing a nightwatch lcov reporter, any advice?

    • Admin says:

      Hi, Thank you for your question. I have no experience with Nightwatch, but as far as I can see it uses Selenium to run tests in a browser. Probably the hard part would be to export the data through Selenium. Maybe this can be done through a plugin?