Skip to content

Commit

Permalink
Add watch task
Browse files Browse the repository at this point in the history
  • Loading branch information
lkrnac committed Jun 23, 2014
1 parent f87db93 commit b5d8a81
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
34 changes: 23 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ var traceur = require('gulp-traceur');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var coveralls = require('gulp-coveralls');
var jshint = require('gulp-jshint');

var paths = {
scripts: 'lib/jasstor.js',
tests: 'test/jasstorSpec.js',
dist: 'dist/jasstor.js'
};

//Compiles ES6 into ES5
gulp.task('build', function () {
return gulp.src('lib/jasstor.js')
return gulp.src(paths.scripts)
.pipe(traceur({
sourceMap: true
}))
Expand All @@ -17,23 +24,28 @@ gulp.task('build', function () {

//Runs mocha test against compiled ES5 source code
gulp.task('test', ['build'], function () {
return gulp.src('test/jasstorSpec.js')
return gulp.src(paths.tests)
.pipe(mocha({
reporter: 'spec'
}));
});

//Runs mocha test ands submits coverage to coveralls.io
gulp.task('coverage', ['build'], function (cb) {
gulp.src(['dist/jasstor.js'])
.pipe(istanbul()) // Covering files
.on('finish', function () {
gulp.src(['test/jasstorSpec.js'])
.pipe(mocha())
// Creating the reports after tests runned
.pipe(istanbul.writeReports())
.on('end', cb);
});
gulp.src([paths.dist])
.pipe(jshint())
.pipe(istanbul())
.on('finish', function () {
gulp.src([paths.tests])
.pipe(jshint())
.pipe(mocha())
.pipe(istanbul.writeReports())
.on('end', cb);
});
gulp.src('coverage/lcov.info')
.pipe(coveralls());
});

gulp.task('watch', function () {
gulp.watch([paths.scripts, paths.tests], ['test']);
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
"gulp": "^3.8.1",
"gulp-coveralls": "^0.1.2",
"gulp-istanbul": "^0.2.0",
"gulp-jshint": "^1.6.3",
"gulp-mocha": "^0.4.1",
"gulp-traceur": "^0.7.0",
"gulp-watch": "^0.6.8",
"jshint-stylish": "^0.2.0"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions test/jasstorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var Jasstor = require('../dist/jasstor.js');

describe('jasstor', function(){
it('should store the password', function(){
describe('jasstor', function () {
it('should store the password', function () {
var jasstor = new Jasstor('ggg');
});
});

0 comments on commit b5d8a81

Please sign in to comment.