-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
30 lines (25 loc) · 787 Bytes
/
Gulpfile.js
File metadata and controls
30 lines (25 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const watch = require("gulp-watch");
const cover = require("gulp-coverage");
const istanbul = require('gulp-istanbul');
gulp.task('pre-test', function () {
return gulp.src(['./answer/*.js', './answer.js'])
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function () {
return gulp.src(['spec/*.js'])
.pipe(mocha())
// Creating the reports after tests ran
.pipe(istanbul.writeReports())
});
gulp.task('watch', function () {
// Endless stream mode
return watch(['./specs/*.js', './answer/*.js'], ()=>{
gulp.start('test');
});
});
gulp.task('default', ["test", "watch"])