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

codecov.io

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codecov.io - npm Package Compare versions

Comparing version 0.0.8 to 0.1.0

lib/services/appveyor.js

9

lib/getConfiguration.js

@@ -6,2 +6,4 @@ var services = {

'drone' : require('./services/drone'),
'appveyor' : require('./services/appveyor'),
'wercker' : require('./services/wercker'),
'jenkins' : require('./services/jenkins'),

@@ -20,3 +22,8 @@ 'semaphore' : require('./services/semaphore')

if (!config){
throw new Error("unknown service. could not get configuration");
// coming soon
// var local = require('./services/localGit');
// config = local.configuration();
if (!config){
throw new Error("unknown service. could not get configuration");
}
}

@@ -23,0 +30,0 @@ var token = (process.env.codecov_token || process.env.CODECOV_TOKEN);

27

lib/sendToCodeCov.io.js

@@ -8,33 +8,17 @@ var request = require('request');

// curl -X POST -H 'Content-Type: text/lcov' -d 'SF:money.py\nFN:11,(anonymous_1)\nDA:1,1\nDA:2,1\nDA:11,1\nend_of_record' https://codecov.io/upload/v1?token=473c8c5b-10ee-4d83-86c6-bfd72a185a27&commit=743b04806ea677403aa2ff26c6bdeb85005de658&branch=master
//
var sendToCodecov = function(str, cb){
var withTestTokenUrl = 'https://codecov.io/upload/v1?token=473c8c5b-10ee-4d83-86c6-bfd72a185a27&commit=743b04806ea677403aa2ff26c6bdeb85005de658&branch=master';
var configuration = getConfiguration();
console.log("configuration: ", configuration);
var query = {
commit : configuration.commitId,
build : configuration.buildId,
branch : configuration.branch
};
if (configuration.service == 'travis'){
query.travis_job_id = configuration.buildId;
}
if (!!configuration.pullRequest){
query.pull_request = configuration.pullRequest;
}
var query = getConfiguration();
console.log("configuration: ", query);
var token = (process.env.codecov_token || process.env.CODECOV_TOKEN);
if (configuration.token){
query.token = configuration.token;
if (token){
query.token = token;
}
var url = urlgrey('https://codecov.io/upload/v1').query(query).toString();
var url = urlgrey('https://codecov.io/upload/v2').query(query).toString();
var headers = {
'content-type' : 'text/lcov'
};
var body = str;
var options = {
url : url,
headers : headers,
body : body

@@ -51,3 +35,2 @@ };

body : body,
headers : response.headers,
request : options

@@ -54,0 +37,0 @@ };

@@ -12,9 +12,10 @@ module.exports = {

service : 'circle',
buildId : env.CIRCLE_BUILD_NUM,
commitId : env.CIRCLE_SHA1,
build : env.CIRCLE_BUILD_NUM,
branch : env.CIRCLE_BRANCH
commit : env.CIRCLE_SHA1,
branch : env.CIRCLE_BRANCH,
owner : env.CIRCLE_PROJECT_USERNAME,
repo : env.CIRCLE_PROJECT_REPONAME,
};
if (env.CIRCLE_PULL_REQUEST){
retval.pullRequest = env.CIRCLE_PULL_REQUEST;
retval.pull_request = env.CIRCLE_PULL_REQUEST;
}

@@ -21,0 +22,0 @@ return retval;

@@ -12,5 +12,5 @@ module.exports = {

service : 'codeship',
buildId : env.CI_BUILD_NUMBER,
commitId : env.CI_COMMIT_ID,
build : env.CI_BUILD_NUMBER,
build_url : env.CI_BUILD_URL,
commit : env.CI_COMMIT_ID,
branch : env.CI_BRANCH

@@ -17,0 +17,0 @@ };

@@ -12,5 +12,5 @@ module.exports = {

service : 'drone',
buildId : env.DRONE_BUILD_NUMBER,
commitId : env.DRONE_COMMIT,
build : env.BUILD_ID,
build : env.DRONE_BUILD_NUMBER,
commit : env.DRONE_COMMIT,
build_url : env.DRONE_BUILD_URL,
branch : env.DRONE_BRANCH

@@ -17,0 +17,0 @@ };

@@ -11,8 +11,8 @@ module.exports = {

return {
root : env.WORKSPACE,
service : 'jenkins',
buildId : env.BUILD_NUMBER,
buildUrl : env.BUILD_URL,
commitId : env.GIT_COMMIT,
branch : env.GIT_BRANCH
commit : env.GIT_COMMIT,
branch : env.GIT_BRANCH,
build : env.BUILD_NUMBER,
build_url : env.BUILD_URL,
root : env.WORKSPACE
};

@@ -19,0 +19,0 @@ }

@@ -1,1 +0,22 @@

// TODO
// var execSync = require('exec-sync');
// module.exports = {
// configuration : function(){
// if (process.version.substr(0, 5) === 'v0.10') {
// var branch = execSync("git rev-parse --abbrev-ref HEAD").trim();
// if (branch === 'HEAD') {
// branch = 'master';
// }
// var head = execSync("git rev-parse HEAD").trim();
// return {
// commit : head,
// branch : branch
// };
// } else {
// // need to do
// throw new Error("Local git currently not supported in node v0.11");
// }
// }
// };

@@ -13,6 +13,7 @@

service : 'semaphore',
buildId : env.SEMAPHORE_BUILD_NUMBER,
commitId : env.SEMAPHORE_PROJECT_HASH_ID,
build : env.SEMAPHORE_BUILD_NUMBER,
branch : env.BRANCH_NAME
commit : env.REVISION,
branch : env.BRANCH_NAME,
owner : env.SEMAPHORE_REPO_SLUG.split('/')[0],
repo : env.SEMAPHORE_REPO_SLUG.split('/')[1]
};

@@ -19,0 +20,0 @@ }

@@ -11,10 +11,12 @@ module.exports = {

var config = {
buildId : env.TRAVIS_JOB_ID,
commitId : env.TRAVIS_COMMIT,
service : 'travis-org',
commit : env.TRAVIS_COMMIT,
build : env.TRAVIS_JOB_NUMBER,
branch : env.TRAVIS_BRANCH,
service : 'travis'
travis_job_id : env.TRAVIS_JOB_ID,
owner : env.TRAVIS_REPO_SLUG.split('/')[0],
repo : env.TRAVIS_REPO_SLUG.split('/')[1]
};
if (!!env.TRAVIS_PULL_REQUEST && env.TRAVIS_PULL_REQUEST !== 'false'){
config.pullRequest = env.TRAVIS_PULL_REQUEST;
config.pull_request = env.TRAVIS_PULL_REQUEST;
}

@@ -21,0 +23,0 @@ return config;

{
"name": "codecov.io",
"version": "0.0.8",
"version": "0.1.0",
"description": "lcov posting to codecov.io",

@@ -36,5 +36,4 @@ "main": "index.js",

"jshint": "2.5.5",
"mocha": "1.21.4",
"mocha-lcov-reporter": "0.0.1"
"mocha": "2.2.1"
}
}

@@ -1,11 +0,8 @@

#codecov.io
# codecov.io
[![Build Status][travis-image]][travis-url]
[![codecov.io](https://codecov.io/github/cainus/codecov.io/coverage.svg?branch=master)](https://codecov.io/github/cainus/codecov.io?branch=master)
[![Build Status][travis-image]][travis-url] [![codecov.io](https://codecov.io/github/cainus/codecov.io/coverage.svg?branch=master)](https://codecov.io/github/cainus/codecov.io?branch=master)
[Codecov.io](https://codecov.io/) support for node.js. Get the great coverage reporting of codecov.io and add a cool coverage button ( like the one above ) to your README.
Supported CI services: [travis-ci](https://travis-ci.org/)
##Installation:
## Installation:
Add the latest version of `codecov.io` to your package.json:

@@ -16,16 +13,11 @@ ```

If you're using mocha, add `mocha-lcov-reporter` to your package.json:
```
npm install mocha-lcov-reporter --save
```
## Usage:
##Usage:
This script ( `bin/codecov.io.js` ) can take standard input from any tool that emits the lcov, gcov or standardized json data format and send it to codecov.io to report your code coverage there.
This script ( `bin/codecov.io.js` ) can take standard input from any tool that emits the lcov data format (including [mocha](http://visionmedia.github.com/mocha/)'s [LCov reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to codecov.io to report your code coverage there.
Once your app is instrumented for coverage, and building, you need to pipe the coverage reports output to `./node_modules/codecov.io/bin/codecov.io.js`.
Once your app is instrumented for coverage, and building, you need to pipe the lcov output to `./node_modules/codecov.io/bin/codecov.io.js`.
This library currently supports the following CI companies: [Travis CI](https://travis-ci.org/), [Appveyor](https://appveyor.com/), [CircleCI](https://circleci.com/), [Codeship](https://codeship.io/), [Drone](https://drone.io/), [Jenkins](http://jenkins-ci.org/), [Shippable](https://shippable.com/), [Semaphore](https://semaphoreapp.com/), [Wercker](https://wercker.com/)
This library currently supports [travis-ci](https://travis-ci.org/) with no extra effort beyond that.
### [Istanbul](https://github.com/gotwarlost/istanbul)

@@ -36,3 +28,3 @@

```sh
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js && rm -rf ./coverage
istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec && cat ./coverage/coverage.json | ./node_modules/codecov.io/bin/codecov.io.js
```

@@ -43,3 +35,3 @@

```sh
istanbul cover jasmine-node --captureExceptions spec/ && cat ./coverage/lcov.info | ./node_modules/codecov.io/bin/codecov.io.js && rm -rf ./coverage
istanbul cover jasmine-node --captureExceptions spec/ && cat ./coverage/coverage.json | ./node_modules/codecov.io/bin/codecov.io.js
```

@@ -56,5 +48,1 @@

I also don't care for "soft-versioning" or "optimistic versioning" (dependencies that have ^, x, > in them, or anything other than numbers and dots). There have been too many problems with bad semantic versioning in dependencies, and I'd rather have a solid library than a bleeding edge one.

@@ -11,10 +11,16 @@ var getConfiguration = require("../lib/getConfiguration");

process.env.TRAVIS_BRANCH = 'master';
process.env.TRAVIS_REPO_SLUG = 'owner/repo';
process.env.CODECOV_TOKEN = 'asdf-asdf-asdf-asdf';
if (process.env.TRAVIS_PULL_REQUEST) {
process.env.TRAVIS_PULL_REQUEST = 'false';
}
expect(getConfiguration()).to.eql({
service : 'travis',
buildId : '1234',
commitId : '5678',
service : 'travis-org',
commit : '5678',
build : '91011',
branch : 'master',
token : 'asdf-asdf-asdf-asdf'
travis_job_id : '1234',
token : 'asdf-asdf-asdf-asdf',
owner : 'owner',
repo : 'repo'
});

@@ -28,10 +34,16 @@ });

process.env.TRAVIS_BRANCH = 'master';
process.env.TRAVIS_REPO_SLUG = 'owner/repo';
process.env.codecov_token = 'asdf-asdf-asdf-asdf';
if (process.env.TRAVIS_PULL_REQUEST) {
process.env.TRAVIS_PULL_REQUEST = 'false';
}
expect(getConfiguration()).to.eql({
service : 'travis',
buildId : '1234',
commitId : '5678',
service : 'travis-org',
commit : '5678',
build : '91011',
travis_job_id : '1234',
branch : 'master',
token : 'asdf-asdf-asdf-asdf'
token : 'asdf-asdf-asdf-asdf',
owner : 'owner',
repo : 'repo'
});

@@ -38,0 +50,0 @@ });

@@ -1,2 +0,2 @@

var travis = require("../../lib/services/circle");
var circle = require("../../lib/services/circle");

@@ -7,3 +7,3 @@ describe("circle service", function(){

process.env.CIRCLECI = "true";
expect(travis.detect()).to.be(true);
expect(circle.detect()).to.be(true);
});

@@ -16,8 +16,11 @@

process.env.CIRCLE_BRANCH = 'master';
expect(travis.configuration()).to.eql({
process.env.CIRCLE_PROJECT_USERNAME = 'owner';
process.env.CIRCLE_PROJECT_REPONAME = 'repo';
expect(circle.configuration()).to.eql({
service : 'circle',
buildId : '1234',
commitId : '5678',
build : '1234',
branch : 'master'
build : '1234',
commit : '5678',
branch : 'master',
owner : 'owner',
repo : 'repo'
});

@@ -31,9 +34,12 @@ });

process.env.CIRCLE_PULL_REQUEST = 'blah';
expect(travis.configuration()).to.eql({
process.env.CIRCLE_PROJECT_USERNAME = 'owner';
process.env.CIRCLE_PROJECT_REPONAME = 'repo';
expect(circle.configuration()).to.eql({
service : 'circle',
buildId : '1234',
commitId : '5678',
commit : '5678',
build : '1234',
branch : 'master',
pullRequest : 'blah',
pull_request : 'blah',
owner : 'owner',
repo : 'repo'
});

@@ -40,0 +46,0 @@ });

@@ -18,5 +18,5 @@ var jenkins = require("../../lib/services/jenkins");

service : 'jenkins',
buildId : '1234',
buildUrl : 'http://asdf/',
commitId : '5678',
build_url : 'http://asdf/',
build : '1234',
commit : '5678',
root : '/var/lib/jenkins/workspace',

@@ -23,0 +23,0 @@ branch : 'master'

@@ -16,8 +16,14 @@ var travis = require("../../lib/services/travis");

process.env.TRAVIS_BRANCH = 'master';
process.env.TRAVIS_REPO_SLUG = 'owner/repo';
if (process.env.TRAVIS_PULL_REQUEST) {
process.env.TRAVIS_PULL_REQUEST = 'false';
}
expect(travis.configuration()).to.eql({
service : 'travis',
buildId : '1234',
commitId : '5678',
service : 'travis-org',
commit : '5678',
build : '91011',
branch : 'master'
branch : 'master',
travis_job_id : '1234',
owner : 'owner',
repo : 'repo'
});

@@ -32,9 +38,12 @@ });

process.env.TRAVIS_PULL_REQUEST = 'blah';
process.env.TRAVIS_REPO_SLUG = 'owner/repo';
expect(travis.configuration()).to.eql({
service : 'travis',
buildId : '1234',
commitId : '5678',
service : 'travis-org',
commit : '5678',
build : '91011',
branch : 'master',
pullRequest : 'blah',
travis_job_id : '1234',
pull_request : 'blah',
owner : 'owner',
repo : 'repo'
});

@@ -41,0 +50,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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