/
gulpfile.js
41 lines (32 loc) · 970 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
38
39
40
41
'use strict';
var gulp = require('gulp'),
Server = require('karma').Server;
var watch = function (configPath, done) {
new Server({
configFile: configPath,
autoWatch: true,
singleRun: false
}, done).start();
};
var test = function (configPath, done) {
new Server({
configFile: configPath,
autoWatch: false,
singleRun: true
}, done).start();
};
gulp.task('karma:browserify', function (done) {
watch(__dirname + '/karma.conf.js', done);
});
gulp.task('karma:webpack', function (done) {
watch(__dirname + '/webpack.karma.conf.js', done);
});
gulp.task('test:browserify', function (done) {
test(__dirname + '/karma.conf.js', done);
});
gulp.task('test:webpack', function (done) {
test(__dirname + '/webpack.karma.conf.js', done);
});
gulp.task('karma', ['karma:browserify', 'karma:webpack']);
gulp.task('test', ['test:browserify', 'test:webpack']);
gulp.task('default', ['karma']);