-
Notifications
You must be signed in to change notification settings - Fork 36
/
gulpfile.js
65 lines (58 loc) · 1.48 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var jscs = require('gulp-jscs');
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var karma = require('karma').server;
var protractor = require("gulp-protractor").protractor;
var serverTestFiles = './test/server/**/*.js';
var clientTestFiles = './test/client/**/*.js';
var e2eTestFiles = './test/e2e/**/*.js';
var files = [
'./server/**/*.js',
'./clinet/**/*.js',
serverTestFiles,
clientTestFiles,
e2eTestFiles
];
// Test
gulp.task('mocha', function () {
return gulp.src(serverTestFiles, {read: false})
.pipe(mocha({
reporter: 'spec'
}))
.once('error', function () {
process.exit(1);
})
.once('end', function () {
process.exit();
});
});
gulp.task('karma', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done);
});
gulp.task('e2e', function () {
return gulp.src(e2eTestFiles)
.pipe(protractor({
configFile: "protractor.conf.js",
args: ['--baseUrl', 'http://localhost:8080']
}))
.on('error', function (e) {
throw e;
})
});
// Style Check
gulp.task('jshint', function () {
return gulp.src(files)
.pipe(jshint({linter: require('jshint-jsx').JSXHINT}))
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail', {verbose: true}));
});
gulp.task('jscs', function () {
return gulp.src(files)
.pipe(jscs());
});
gulp.task('lint', ['jshint', 'jscs']);