forked from rsmbl/Resemble.js
-
Notifications
You must be signed in to change notification settings - Fork 37
/
gulpfile.js
37 lines (31 loc) · 777 Bytes
/
gulpfile.js
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
31
32
33
34
35
36
37
const gulp = require('gulp');
const jasmine = require('gulp-jasmine');
const gutil = require('gulp-util');
const srcFiles = 'resemble.js';
const specFiles = 'resemble.spec.js';
function runTests(breakOnError) {
return gulp.src(specFiles)
.pipe(jasmine({
includeStackTrace: true
}))
.on('error', errorHandler(breakOnError));
}
function errorHandler(breakOnError) {
return function(error) {
if (breakOnError) {
throw error;
} else {
gutil.log(gutil.colors.red('[Jasmine]'), error.toString());
this.emit('end');
}
}
}
gulp.task('test', function() {
return runTests(true);
});
gulp.task('test:auto', function() {
runTests(false);
return gulp.watch([srcFiles, specFiles], function() {
runTests(false);
});
});