grunt-codeclimate-reporter
Advanced tools
Comparing version 1.1.2 to 1.2.0-rc1
@@ -1,4 +0,2 @@ | ||
module.exports = function (grunt) { | ||
'use strict'; | ||
module.exports = function gruntfile(grunt) { | ||
grunt.initConfig({ | ||
@@ -12,3 +10,3 @@ eslint: { | ||
mochaTest: { | ||
src: ['test/**/*.js'], | ||
src: ['test/**/*.js'], | ||
options: { | ||
@@ -27,2 +25,2 @@ reporter: 'nyan' | ||
grunt.registerTask('default', ['eslint']); | ||
}; | ||
}; |
@@ -1,2 +0,2 @@ | ||
Copyright (c) 2015 MrBoolean | ||
Copyright (c) 2015 Marc Binder <marcandrebinder@gmail.com> | ||
@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person |
{ | ||
"name": "grunt-codeclimate-reporter", | ||
"description": "Send your coverage to codeclimate.", | ||
"version": "1.1.2", | ||
"version": "1.2.0-rc1", | ||
"homepage": "https://github.com/MrBoolean/grunt-codeclimate", | ||
"author": { | ||
"name": "MrBoolean", | ||
"email": "marcandrebinder@gmail.com" | ||
}, | ||
"author": "Marc Binder <marcandrebinder@gmail.com>", | ||
"repository": { | ||
@@ -18,18 +15,23 @@ "type": "git", | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/grunt test && ./node_modules/.bin/grunt eslint" | ||
"test": "./node_modules/.bin/grunt test" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^2.9.33", | ||
"codeclimate-test-reporter": "0.0.4" | ||
"codeclimate-test-reporter": "0.1.1", | ||
"mz": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^4.1.3", | ||
"chai": "^3.0.0", | ||
"chai-as-promised": "^5.1.0", | ||
"eslint": "^1.7.3", | ||
"eslint-config-airbnb": "^0.1.0", | ||
"eslint-plugin-react": "^3.6.3", | ||
"grunt": "^0.4.5", | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-eslint": "^16.0.0", | ||
"grunt-eslint": "^17.3.1", | ||
"grunt-mocha-test": "^0.12.7", | ||
@@ -46,4 +48,5 @@ "mocha": "^2.2.5", | ||
"codeclimate", | ||
"coverage" | ||
"coverage", | ||
"reporter" | ||
] | ||
} |
@@ -1,3 +0,1 @@ | ||
[![Build Status](https://travis-ci.org/MrBoolean/grunt-codeclimate-reporter.svg)](https://travis-ci.org/MrBoolean/grunt-codeclimate-reporter) | ||
grunt-codeclimate-reporter | ||
@@ -7,7 +5,7 @@ ========================== | ||
## Getting Started | ||
This plugin requires Grunt `~0.4.5` | ||
[![Build Status](https://travis-ci.org/MrBoolean/grunt-codeclimate-reporter.svg)](https://travis-ci.org/MrBoolean/grunt-codeclimate-reporter) | ||
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
Checkout [gulp-codeclimate-reporter](https://github.com/MrBoolean/gulp-codeclimate-reporter). | ||
## Install | ||
```shell | ||
@@ -17,3 +15,5 @@ npm install grunt-codeclimate-reporter --save-dev | ||
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: | ||
## Usage | ||
### Load task | ||
Once the plugin has been installed, it may be enabled inside your `Gruntfile.js` with this line of JavaScript: | ||
@@ -24,3 +24,3 @@ ```js | ||
Setup: | ||
### Define your target | ||
```js | ||
@@ -34,3 +34,4 @@ grunt.initConfig({ | ||
file: 'path/to/your/lcov.info', | ||
token: 'your_token' | ||
token: 'your_token', | ||
executable: 'path/to/executable' // leave blank to use the default executable | ||
} | ||
@@ -43,2 +44,2 @@ } | ||
**Note** that, `grunt-codeclimate-reporter` is registered as a multi task. So it is required to define your sub task e.g. `main` (or something else). | ||
**Note** that, `grunt-codeclimate-reporter` is registered as a multi task. So it is required to define your sub task e.g. `main` (or something else). |
@@ -1,20 +0,17 @@ | ||
var codeCliMate = require('../lib/codeclimate'); | ||
var reporter = require('../lib/reporter'); | ||
module.exports = function (grunt) { | ||
'use strict'; | ||
grunt.registerMultiTask('codeclimate', 'Send your coverage to codeclimate.', function () { | ||
var done, options; | ||
done = this.async(); | ||
options = this.options({ | ||
module.exports = function task(grunt) { | ||
grunt.registerMultiTask('codeclimate', 'Send your coverage to codeclimate.', function codeclimate() { | ||
var done = this.async(); | ||
var options = this.options({ | ||
token: false, | ||
file: '' | ||
file: '', | ||
executable: null | ||
}); | ||
codeCliMate(options) | ||
.then(function (res) { | ||
reporter(options) | ||
.then(function respondWithRes(res) { | ||
grunt.log.ok(res); | ||
}) | ||
.catch(function (err) { | ||
.catch(function catchErr(err) { | ||
throw err; | ||
@@ -25,2 +22,2 @@ }) | ||
}); | ||
}; | ||
}; |
@@ -1,24 +0,22 @@ | ||
var chai = require('chai'), | ||
sinon = require('sinon'), | ||
chaiAsPromised = require('chai-as-promised'), | ||
assert = chai.assert, | ||
path = require('path'), | ||
proxyquire = require('proxyquire'), | ||
codeCliMate = null; | ||
var chai = require('chai'); | ||
var sinon = require('sinon'); | ||
var chaiAsPromised = require('chai-as-promised'); | ||
var assert = chai.assert; | ||
var path = require('path'); | ||
var proxyquire = require('proxyquire'); | ||
var codeCliMate = null; | ||
chai.use(chaiAsPromised); | ||
describe('tasks/codeclimate', function () { | ||
'use strict'; | ||
it('throws an error if the file does not exist', function () { | ||
codeCliMate = require('../lib/codeclimate'); | ||
describe('tasks/codeclimate', function codeclimateTasktest() { | ||
it('throws an error if the file does not exist', function lcovFileNotExistTest() { | ||
codeCliMate = require('../lib/reporter'); | ||
assert.isRejected( | ||
codeCliMate({ file: 'path/to/nowhere' }), | ||
'Cannot find coverage report file "path/to/nowhere"' | ||
'The lcov file "path/to/nowhere" does not exist' | ||
); | ||
}); | ||
it('throws an error if something went wrong during the execution of codeclimate', function () { | ||
codeCliMate = require('../lib/codeclimate'); | ||
it('throws an error if something went wrong during the execution of codeclimate', function somethingWentWrongTest() { | ||
codeCliMate = require('../lib/reporter'); | ||
@@ -34,10 +32,11 @@ assert.isRejected( | ||
describe('invocation of codeclimate bin', function() { | ||
var fakeToken, execStub; | ||
describe('invocation of codeclimate bin', function invocationTest() { | ||
var fakeToken; | ||
var execStub; | ||
beforeEach(function() { | ||
beforeEach(function runBeforeEach() { | ||
fakeToken = 'abcde'; | ||
execStub = sinon.stub(); | ||
codeCliMate = proxyquire('../lib/codeclimate', { | ||
codeCliMate = proxyquire('../lib/reporter', { | ||
'child_process': { | ||
@@ -49,7 +48,7 @@ exec: execStub | ||
it('spawns a child process with the correct executable', function (done) { | ||
var basePath = path.resolve(__dirname, '..'), | ||
bin = path.resolve(basePath, 'node_modules/.bin/codeclimate'), | ||
lcovFile = path.resolve(basePath, 'test/coverage.lcov'), | ||
command = 'CODECLIMATE_REPO_TOKEN=' + fakeToken + ' ' + bin + ' < ' + lcovFile; | ||
it('spawns a child process with the correct executable', function spawnCorrectTest(done) { | ||
var basePath = path.resolve(__dirname, '..'); | ||
var bin = path.resolve(basePath, 'node_modules/.bin/codeclimate'); | ||
var lcovFile = path.resolve(basePath, 'test/coverage.lcov'); | ||
var command = 'CODECLIMATE_REPO_TOKEN=' + fakeToken + ' ' + bin + ' < ' + lcovFile; | ||
@@ -60,5 +59,5 @@ execStub.callsArg(1); | ||
token: fakeToken, | ||
file: lcovFile | ||
file: lcovFile | ||
}) | ||
.then(function() { | ||
.then(function runAssertion() { | ||
assert.equal(execStub.getCall(0).args[0], command); | ||
@@ -71,3 +70,3 @@ }) | ||
it('rejects with error from exec', function(done) { | ||
it('rejects with error from exec', function rejectWithErrorTest(done) { | ||
var fakeError = new Error('Fake'); | ||
@@ -79,10 +78,11 @@ | ||
token: fakeToken, | ||
file: path.join(__dirname, 'coverage.lcov') | ||
file: path.join(__dirname, 'coverage.lcov') | ||
}) | ||
.catch(function(err) { | ||
.catch(function assertionTest(err) { | ||
assert.equal(err.message, fakeError.message); | ||
}) | ||
.finally(done); | ||
.finally(done) | ||
; | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
41
0
8812
4
14
12
144
1
+ Addedmz@^2.1.0
+ Addedany-promise@1.3.0(transitive)
+ Addedcodeclimate-test-reporter@0.1.1(transitive)
+ Addedmz@2.7.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedthenify@3.3.1(transitive)
+ Addedthenify-all@1.6.0(transitive)
- Removedcodeclimate-test-reporter@0.0.4(transitive)