Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjmorrison committed Aug 15, 2013
0 parents commit afd2428
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
Empty file added LICENSE
Empty file.
46 changes: 46 additions & 0 deletions README.md
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',
]
```
31 changes: 31 additions & 0 deletions package.json
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": "*"
}
}
13 changes: 13 additions & 0 deletions tasks/main.js
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());
});
};

0 comments on commit afd2428

Please sign in to comment.