Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codacy

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codacy

Code Coverage reporter for Codacy.com [DEPRECATED]

  • 1.0.1-1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
2
Weekly downloads
 
Created
Source

Codacy [DEPRECATED]

Renamed to codacy-coverage

Codacy support for Node.js. Get coverage reporting and code analysis for Node.js from Codacy.

Build Status npm npm Codacy David David David

##Installation: Add the latest version of codacy to your package.json:

npm install codacy --save

If you're using mocha, add mocha-lcov-reporter to your package.json:

npm install mocha-lcov-reporter --save

##Usage:

This script ( bin/codacy.js ) can take standard input from any tool that emits the lcov data format (including mocha's LCov reporter) and send it to Codacy to report your code coverage there.

Once your app is instrumented for coverage, and building, you need to pipe the lcov output to ./node_modules/codacy/bin/codacy.js.

You'll need to provide the Report token from Codacy via an environment variable:

  • CODACY_REPO_TOKEN (the secret repo token from Codacy.com)

Mocha + Blanket.js

  • Install blanket.js
  • Configure blanket according to docs.
  • Run your tests with a command like this:
NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha \
  --require blanket \
  --reporter mocha-lcov-reporter |  ./node_modules/codacy/bin/codacy.js

Mocha + JSCoverage

Instrumenting your app for coverage is probably harder than it needs to be (read here), but that's also a necessary step.

In mocha, if you've got your code instrumented for coverage, the command for a travis build would look something like this:

YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/codacy/bin/codacy.js

Istanbul

With Mocha:

istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/codacy/bin/codacy.js && rm -rf ./coverage

With Jasmine:

istanbul cover jasmine-node --captureExceptions spec/ && cat ./coverage/lcov.info | ./node_modules/codacy/bin/codacy.js && rm -rf ./coverage

Poncho

Client-side JS code coverage using PhantomJS, Mocha and Blanket:

  • Configure Mocha for browser
  • Mark target script(s) with data-cover html-attribute
  • Run your tests with a command like this:
./node_modules/.bin/poncho -R lcov test/test.html | ./node_modules/codacy/bin/codacy.js

License

MIT

Keywords

FAQs

Package last updated on 03 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc