-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
59 lines (50 loc) · 1.56 KB
/
gulpfile.babel.js
File metadata and controls
59 lines (50 loc) · 1.56 KB
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
52
53
54
55
56
57
58
59
const eslint = require('gulp-eslint');
const gulp = require('gulp');
const istanbul = require('gulp-istanbul');
const KarmaServer = require('karma').Server;
const mocha = require('gulp-mocha');
const runSequence = require('run-sequence');
const webpack = require('webpack-stream');
const webpackClientConfig = require('./resources/client/webpack/webpack-client.config.js');
gulp.task('build-client', () => gulp.src('./src/client/app.jsx')
.pipe(webpack(webpackClientConfig))
.pipe(gulp.dest('./resources/server/public')));
gulp.task('build', (done) => {
runSequence('build-client', done);
});
gulp.task('eslint', () => {
const jsFiles = [
'./**/*.js',
'./**/*.jsx',
'!./node_modules/**/*.js',
'!./out/**/*.js',
'!./out/**/*.jsx',
'!./resources/server/public/**/*.js',
'!./target/**/*.js'
];
return gulp.src(jsFiles)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('testServer', () => {
process.env.NODE_CONFIG_DIR = './test-resources/server/config';
gulp.src('./src/server/**/*.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire());
return gulp.src('./test/server/**/*Spec.js')
.pipe(mocha({reporter: 'spec'}))
.pipe(istanbul.writeReports({
dir: './target/coverage/server',
reporters: ['lcov']
}));
});
gulp.task('testPublic', (done) => {
new KarmaServer({
configFile: `${__dirname}/test-resources/client/karma.conf.js`,
singleRun: true
}, done).start();
});
gulp.task('test', (done) => {
runSequence('eslint', 'testServer', 'testPublic', done);
});