-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit afd2428
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# grunt-karma-coveralls | ||
|
||
|
||
## Getting Started | ||
|
||
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: | ||
|
||
```shell | ||
npm install grunt-karma-coveralls--save-dev | ||
``` | ||
|
||
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: | ||
|
||
```js | ||
grunt.loadNpmTasks('grunt-karma-coveralls'); | ||
``` | ||
|
||
## Grunt Configuration Example: | ||
|
||
```js | ||
coveralls: { | ||
options: { | ||
repo_token: 'your coveralls repo token', | ||
service_name: 'your coveralls service name', | ||
coverage_dir: 'directory name' | ||
} | ||
} | ||
``` | ||
|
||
If you haven't used [Karma](http://karma-runner.github.io/) before, check out the video on the homepage. | ||
|
||
## Karma Configuration Example: | ||
|
||
```js | ||
reporters: ['coverage'], | ||
preprocessors: { | ||
"**/lib/*js": "coverage" | ||
}, | ||
coverageReporter: { | ||
type: "lcov", | ||
dir: "coverage/" | ||
}, | ||
plugins: [ | ||
'karma-coverage', | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"author": { | ||
"name": "Matthew J. Morrison", | ||
"email": "[email protected]" | ||
}, | ||
"name": "grunt-karma-coveralls", | ||
"description": "An npm module for using Karma and Coveralls with Grunt", | ||
"version": "0.0.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mattjmorrison/grunt-karma-coveralls" | ||
}, | ||
"keywords": [ | ||
"Grunt.js", | ||
"Karma", | ||
"Coveralls.js" | ||
], | ||
"main": "./lib/main", | ||
"engines": { | ||
"node": ">=v0.8.1" | ||
}, | ||
"licenses": [ | ||
"MIT" | ||
], | ||
"readmeFilename": "README.md", | ||
"dependencies": { | ||
"coveralls": "~2.1.0", | ||
"karma-coverage": "~0.1.0", | ||
"glob": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = function(grunt){ | ||
var glob = require('glob'); | ||
var fs = require('fs'); | ||
var handleInput = require('coveralls/lib/handleInput'); | ||
|
||
grunt.task.registerTask('coveralls', 'Coveralls coverage with Karma', function(){ | ||
var options = grunt.config('coveralls.options'); | ||
lcov_path = glob.sync(options.coverage_dir + "/**/lcov.info")[0]; | ||
process.env.COVERALLS_REPO_TOKEN = options.repo_token; | ||
process.env.COVERALLS_SERVICE_NAME = options.service_name; | ||
handleInput(fs.readFileSync(lcov_path).toString()); | ||
}); | ||
}; |