Search code examples
node.jsmocha.jsjscoverage

Mocha and JSCover


I am using mocha test my nodejs code. I would like to get a coverage report. I found the JSCover I am trying to run. But I am getting

ReferenceError: _$jscoverage is not defined

I am executing:

   java -jar ../tools/jscover/JSCover-all.jar --no-instrument=node_modules -fs api/ api-coverage

test:
    @NODE_ENV=test ./node_modules/.bin/mocha \
        --require expect.js \
        --reporter $(REPORTER) \
        --timeout 2000 \
        --growl \
        $(TESTS)
    COVERAGE_ENABLED=1 $(MAKE) test REPORTER=html-file-cov

Any help?


Solution

  • I can't help you with JSCover, but I highly recommend using the fully-Javascript-based istanbul instead. Details here: Code coverage with Mocha