forked from SGVDT/SGVDT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (44 loc) · 1.21 KB
/
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
42
43
44
45
46
47
48
49
50
51
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const mocha = require('gulp-mocha');
const webpack = require('webpack-stream');
const KarmaServer = require('karma').Server;
const maps = require('gulp-sourcemaps');
var paths = {
server: ['lib/**/*.js', 'model/**/*.js', 'server/**/*.js', 'index.js', 'gulpfile.js'],
client: ['front_end/app/**/*.js', 'front_end/gulpfile.js', 'front_end/server.js'],
test: ['test/**/*test.js']
};
// lint tasks
gulp.task('lint:server', () => {
return gulp.src(paths.server)
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('lint:client', () => {
return gulp.src(paths.client)
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('lint', ['lint:server', 'lint:client']);
// build test task
gulp.task('webpack:test', () => { // ['lint'],
return gulp.src('test/unit/test_entry.js')
.pipe(webpack({
devtool: 'source-map',
output: {
filename: 'bundle.js'
}
}))
.pipe(gulp.dest('./test'));
});
// test tasks
gulp.task('mocha', () => {
return gulp.src(paths.test)
.pipe(mocha());
});
gulp.task('karma', ['webpack:test'], (done) => {
new KarmaServer({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});