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

fetch-coverage

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-coverage - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

CHANGELOG.md

23

index.js
'use strict';
const hostedGitInfo = require('hosted-git-info');
const find = require('lodash.find');
const fetchers = require('require-directory')(module, './lib', { recurse: false });

@@ -9,3 +8,3 @@ const shieldsIo = require('./lib/util/shieldsIo');

function tryBadges(options) {
const coverageBadge = find(options.badges, (badge) => badge.info.type === 'coverage');
const coverageBadge = options.badges && options.badges.find((badge) => badge.info.type === 'coverage');
const shieldsIoUrl = coverageBadge && coverageBadge.urls.content;

@@ -19,10 +18,10 @@

const promises = options.services.map((service) => {
return fetchers[service] && fetchers[service](gitInfo, options)
.catch((err) => { errors.push(err); });
});
const promises = options.services.map((service) =>
fetchers[service] && fetchers[service](gitInfo, options)
.catch((err) => { errors.push(err); })
);
return Promise.all(promises)
.then((coverages) => {
const coverage = find(coverages, (coverage) => coverage != null);
const coverage = coverages.find((coverage) => coverage != null);

@@ -51,10 +50,11 @@ if (coverage != null) {

} catch (err) {
return Promise.resolve(null);
/* istanbul ignore next */
return null;
}
if (!gitInfo) {
return Promise.resolve(null);
return null;
}
options = Object.assign({
options = {
branch: null,

@@ -64,3 +64,4 @@ badges: null,

got: { timeout: 15000 },
}, options);
...options,
};

@@ -67,0 +68,0 @@ // Try fetching the coverage from the coverage badge if any

@@ -7,3 +7,3 @@ 'use strict';

const servicesSupportedTypesMap = {
coveralls: ['github'], // Coveralls actually supports bitbucket but shields.io only supports github, see: https://github.com/badges/shields/issues/793
coveralls: ['github'], // Coveralls actually supports bitbucket but shields.io only supports github, see: https://github.com/badges/shields/issues/793
codeclimate: ['github', 'bitbucket', 'gitlab'],

@@ -48,3 +48,8 @@ scrutinizer: ['github', 'bitbucket'],

function request(url, options) {
return got(url, Object.assign({}, options.got, { json: true }))
options = {
...options,
json: true,
};
return got(url, options)
.then((response) => {

@@ -51,0 +56,0 @@ const json = response.body;

{
"name": "fetch-coverage",
"version": "1.1.0",
"description": "Fetch the code coverage from an open-source GIT repository, using a variety of well-known coverage services",
"main": "index.js",
"scripts": {
"lint": "eslint '{*.js,test/**/*.js}' --ignore-pattern=test/coverage",
"test": "mocha --bail",
"test-cov": "istanbul cover --dir test/coverage _mocha -- && echo Coverage lies in test/coverage/lcov-report/index.html",
"test-travis": "istanbul cover _mocha --report lcovonly -- && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"bugs": {
"url": "https://github.com/IndigoUnited/node-fetch-coverage/issues/"
},
"repository": {
"type": "git",
"url": "git://github.com/IndigoUnited/node-fetch-coverage.git"
},
"version": "2.0.0",
"keywords": [

@@ -28,23 +14,56 @@ "code",

],
"author": "IndigoUnited <hello@indigounited.com> (http://indigounited.com)",
"author": "André Cruz <andre@moxy.studio>",
"homepage": "https://github.com/moxystudio/node-fetch-coverage",
"repository": {
"type": "git",
"url": "git@github.com:moxystudio/node-fetch-coverage.git"
},
"license": "MIT",
"files": [
"index.js",
"lib"
],
"main": "index.js",
"scripts": {
"lint": "eslint .",
"test": "jest --env node --coverage",
"test-travis": "NOCK_BACK_MODE=lockdown npm test",
"prerelease": "npm t && npm run lint",
"release": "standard-version",
"precommit": "lint-staged",
"commitmsg": "commitlint -e $GIT_PARAMS"
},
"standard-version": {
"scripts": {
"posttag": "git push --follow-tags origin master && npm publish"
}
},
"lint-staged": {
"*.js": [
"eslint --fix --ignore-pattern test/fixtures",
"git add"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"dependencies": {
"got": "^6.5.0",
"got": "^9.2.2",
"hosted-git-info": "^2.1.5",
"lodash.find": "^4.6.0",
"require-directory": "^2.1.1"
},
"devDependencies": {
"@satazor/eslint-config": "^3.0.0",
"chai": "^3.4.1",
"coveralls": "^2.11.6",
"eslint": "^3.0.0",
"istanbul": "^0.4.1",
"lodash": "^4.15.0",
"mocha": "^3.0.0",
"nock": "^9.0.2"
},
"engines": {
"node": ">=4.0.0"
"@commitlint/cli": "^7.0.0",
"@commitlint/config-conventional": "^7.0.0",
"eslint": "^5.3.0",
"eslint-config-moxy": "^6.0.1",
"husky": "^0.14.0",
"jest": "^23.4.1",
"jest-serializer-path": "^0.1.15",
"lint-staged": "^7.2.0",
"standard-version": "^4.4.0",
"nock": "^10.0.0"
}
}
# fetch-coverage
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url]

@@ -8,10 +8,12 @@ [npm-url]:https://npmjs.org/package/fetch-coverage

[npm-image]:http://img.shields.io/npm/v/fetch-coverage.svg
[travis-url]:https://travis-ci.org/IndigoUnited/node-fetch-coverage
[travis-image]:http://img.shields.io/travis/IndigoUnited/node-fetch-coverage/master.svg
[coveralls-url]:https://coveralls.io/r/IndigoUnited/node-fetch-coverage
[coveralls-image]:https://img.shields.io/coveralls/IndigoUnited/node-fetch-coverage/master.svg
[david-dm-url]:https://david-dm.org/IndigoUnited/node-fetch-coverage
[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-fetch-coverage.svg
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-fetch-coverage#info=devDependencies
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-fetch-coverage.svg
[travis-url]:https://travis-ci.org/moxystudio/node-fetch-coverage
[travis-image]:http://img.shields.io/travis/moxystudio/node-fetch-coverage/master.svg
[codecov-url]:https://codecov.io/gh/moxystudio/node-fetch-coverage
[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/node-fetch-coverage/master.svg
[david-dm-url]:https://david-dm.org/moxystudio/node-fetch-coverage
[david-dm-image]:https://img.shields.io/david/moxystudio/node-fetch-coverage.svg
[david-dm-dev-url]:https://david-dm.org/moxystudio/node-fetch-coverage?type=dev
[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/node-fetch-coverage.svg
[greenkeeper-image]:https://badges.greenkeeper.io/moxystudio/node-fetch-coverage.svg
[greenkeeper-url]:https://greenkeeper.io/

@@ -27,3 +29,5 @@ Fetch the code coverage from an open-source GIT repository, using a variety of well-known coverage services.

`$ npm install fetch-coverage`
```sh
$ npm install fetch-coverage
```

@@ -38,3 +42,3 @@

fetchCoverage('git@github.com:IndigoUnited/node-planify.git')
fetchCoverage('git@github.com:moxystudio/node-planify.git')
// `coverage` is a number between 0 and 1 or `null` if there's no code coverage

@@ -56,4 +60,6 @@ .then((coverage) => console.log('Coverage', coverage));

`$ npm test`
`$ npm test-cov` to get coverage report
```sh
$ npm test
$ npm test -- --watch # during development
```

@@ -60,0 +66,0 @@

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