-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathgulpfile.js
49 lines (41 loc) · 1.35 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
'use strict';
require('./environment');
const os = require('os');
const gulp = require('gulp');
const mocha = require('gulp-mocha');
const istanbul = require('gulp-istanbul');
const coveralls = require('gulp-coveralls');
const eslint = require('gulp-eslint');
const runSequence = require('run-sequence');
if (!('COVERALLS_SERVICE_NAME' in process.env)) {
process.env.COVERALLS_SERVICE_NAME = `${os.hostname()}.${os.platform()}-${os.release()}`;
}
process.env.COVERALLS_REPO_TOKEN = 'EI2vRz1HRhJ3pGi7g3J6sMxI4dsnrWxtb';
const filesToLint = [
'gulpfile.js',
'index.js',
'environment.js',
'./server/**/*.js',
'!node_modules/**',
];
gulp.task('lint', () => gulp.src(filesToLint)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError()));
gulp.task('coverage', () => gulp
.src(['!node_modules/**', '!server/routes/**', './server/**/*.js'])
.pipe(istanbul({ includeUntested: true }))
.pipe(istanbul.hookRequire()));
gulp.task('test:backend', () => gulp.src(['test/**/*.js'])
.pipe(mocha({ reporter: 'spec' }))
.once('error', err => {
throw err;
})
.pipe(istanbul.writeReports({
dir: './coverage',
reporters: ['html', 'lcov', 'text', 'json'],
})));
gulp.task('coveralls', () => gulp.src('coverage/lcov.info').pipe(coveralls()));
gulp.task('test', callback => {
runSequence('lint', 'coverage', 'test:backend', callback);
});