Skip to content

Commit

Permalink
Move to gulp for test, add coveralls and codacy badges, bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
iandotkelly committed Apr 12, 2015
1 parent db853e2 commit edbc0f5
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 32 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
coverage.html
lib-cov/
reports/
.coverrun
.coverdata
npm-debug.log
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ node_js:
- "iojs"
- "0.12"
- "0.10"
before_install:
- npm install -g gulp@3.8.11
23 changes: 0 additions & 23 deletions Makefile

This file was deleted.

62 changes: 62 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @description - gulp build file
*
* @copyright Ian Kelly 2015
*/

'use strict';

var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var cover = require('gulp-coverage');
var coveralls = require('gulp-coveralls');

// set coveralls environmental variable
process.env['COVERALLS_REPO_TOKEN'] = 'rCIR66aQA8jUA7Berlh1PHd917mjMt4hU';

/**
* Linting task
*/
gulp.task('lint', function() {
return gulp.src(['lib/**/*.js', 'test/unit/**/*.js', 'gulpfile.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});

/**
* Task for developer test and coverage report
*/
gulp.task('test', ['lint'], function () {
return gulp.src(['lib/**/*.js', 'test/unit/**/*.js'], { read: false })
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'))
.pipe(cover.instrument({
pattern: ['lib/**/*.js']
}))
.pipe(mocha())
.pipe(cover.gather())
.pipe(cover.format())
.pipe(gulp.dest('reports'));
});

/**
* Task for travis-ci which pipes coverage to coveralls
*/
gulp.task('test-coveralls', ['lint'], function() {
return gulp.src(['lib/**/*.js', 'test/unit/**/*.js'], { read: false })
.pipe(cover.instrument({
pattern: ['lib/**/*.js']
}))
.pipe(mocha())
.pipe(cover.gather())
.pipe(cover.format({
reporter: 'lcov'
}))
.pipe(coveralls());
});

gulp.task('default', ['lint', 'test']);
gulp.task('travis', ['lint', 'test-coveralls']);
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
"archy": "1.0.0",
"commander": "2.7.1",
"glob-all": "3.0.1",
"read-installed": "3.1.5"
"read-installed": "4.0.0"
},
"devDependencies": {
"jshint": "^2.6.3",
"mocha": "^2.2.1",
"gulp": "^3.8.11",
"gulp-coverage": "^0.3.34",
"gulp-coveralls": "^0.1.3",
"gulp-jshint": "^1.10.0",
"gulp-mocha": "^2.0.1",
"should": "^5.2.0"
},
"engines": {
Expand All @@ -38,6 +41,6 @@
"cli"
],
"scripts": {
"test": "make"
"test": "gulp travis"
}
}
9 changes: 6 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

[![Version](https://img.shields.io/npm/v/nlf.svg)](https://www.npmjs.com/package/nlf) [![Downloads](https://img.shields.io/npm/dm/nlf.svg)](https://www.npmjs.com/package/nlf)
[![Build Status](https://img.shields.io/travis/iandotkelly/nlf.svg)](https://travis-ci.org/iandotkelly/nlf) [![Dependency Status](https://gemnasium.com/iandotkelly/nlf.png)](https://gemnasium.com/iandotkelly/nlf)

[![Codacy Badge](https://www.codacy.com/project/badge/2c7e00c886b14a3a81e06a5eec19aa1f)](https://www.codacy.com/app/iandotkelly/nlf)
[![Coveralls](https://img.shields.io/coveralls/iandotkelly/nlf.svg)](https://coveralls.io/r/iandotkelly/nlf)

nlf is a utility for attempting to identify the licenses of modules in a node.js project.

Expand Down Expand Up @@ -143,12 +144,14 @@ Each

### Tests

To run the npm unit tests, install development dependencies and run tests with 'npm test' or 'make'.
To run the unit tests, install development dependencies and run tests with 'gulp'. Requires [gulp.js](http://gulpjs.com/) to be installed globally.

```sh
# only need to install gulp if you have not done so already
$ npm install -g gulp
$ cd nlf
$ npm install
$ npm test
$ gulp
```
If you contribute to the project, tests are written in [mocha](http://visionmedia.github.com/mocha/), using [should.js](https://github.com/visionmedia/should.js/) or the node.js assert module.

Expand Down

0 comments on commit edbc0f5

Please sign in to comment.