Skip to content

Commit

Permalink
Flesh out readme with useful instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Dec 28, 2013
1 parent fdb0e64 commit 813a319
Showing 1 changed file with 13 additions and 48 deletions.
61 changes: 13 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# grunt-coveralls
# Grunt-Coveralls

> Grunt task to load coverage results and submit them to Coveralls.io
Expand All @@ -19,71 +19,36 @@ grunt.loadNpmTasks('grunt-coveralls');

## The "coveralls" task

### Overview
In your project's Gruntfile, add a section named `coveralls` to the data object passed into `grunt.initConfig()`.
Grunt-coveralls takes one or more lcov file, and uploads them to [coveralls.io](https://coveralls.io).

```js
grunt.initConfig({
coveralls: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
```

### Options

#### options.separator
Type: `String`
Default value: `', '`
Everything more specific than that it handled internally by [node-coveralls](https://github.com/cainus/node-coveralls), and Coveralls itself.

A string value that is used to do something with whatever.

#### options.punctuation
Type: `String`
Default value: `'.'`

A string value that is used to do something else with whatever else.

### Usage Examples

#### Default Options
In this example, the default options are used to do something with whatever. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result would be `Testing, 1 2 3.`

```js
grunt.initConfig({
coveralls: {
options: {},
files: {
'dest/default_options': ['src/testing', 'src/123'],
},
},
});
```
The only required option is a 'src' parameter, which accepts all the standard grunt src formats (plain path, glob, array of paths) and attempts to parse the matched lcov files and upload them.

#### Custom Options
In this example, custom options are used to do something else with whatever else. So if the `testing` file has the content `Testing` and the `123` file had the content `1 2 3`, the generated result in this case would be `Testing: 1 2 3 !!!`
This grunt task will pass as long as at least one file is matched, and all matched files are uploaded successfully.

```js
grunt.initConfig({
coveralls: {
options: {
separator: ': ',
punctuation: ' !!!',
// LCOV coverage file relevant to every target
src: 'coverage-results/lcov.info'
},
files: {
'dest/default_options': ['src/testing', 'src/123'],
your_target: {
// Target-specific LCOV coverage file
src: 'coverage-results/extra-results-*.info'
},
},
});
```

This can then be run with `grunt coveralls` or `grunt coveralls:your_target`. For a practical example, look at this project, which uses itself to track its own coverage.

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. To ensure your code runs correctly, run `npm test`.

## Release History
_(Nothing yet)_

0 comments on commit 813a319

Please sign in to comment.