This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
70 lines (61 loc) · 1.67 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
66
67
68
69
70
const gulp = require('gulp');
const reporters = require('jasmine-reporters');
const jasmine = require('gulp-jasmine');
const istanbul = require('gulp-istanbul');
const del = require('del');
const execSync = require('child_process').execSync;
const sources = [
'main/**/*.js'
];
const testSources = [
'tests/jasmine/*.js'
];
const jasmineOpts = {
reporter: [
new reporters.TerminalReporter({
verbosity: 3,
color: true,
showStack: true
}),
new reporters.JUnitXmlReporter({
savePath: './report/junit/'
}),
],
includeStackTrace: true,
verbose: true,
timeout: 30000
};
gulp.task('clean', () => del('report/**'));
gulp.task('test:coverage:prepare', () => {
return gulp.src(sources)
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});
gulp.task('test:coverage', ['clean', 'test:coverage:prepare'], () => {
return gulp.src(testSources)
.pipe(jasmine(jasmineOpts))
.pipe(istanbul.writeReports({
dir: './report',
reporters: ['text-summary', 'html'],
reportOpts: {dir: './report/coverage'}
}))
.pipe(istanbul.enforceThresholds({
thresholds: {
global: {
statements: 80,
functions: 80,
branches: 80,
lines: 80
}
}
}));
});
gulp.task('lint', () => {
execSync('npm run lint', {stdio: 'inherit'});
});
gulp.task('test', ['lint' ,'test:coverage'], () => {
return gulp.src(testSources)
.pipe(jasmine(jasmineOpts));
});