forked from westy92/html-pdf-chrome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
60 lines (53 loc) · 1.57 KB
/
Copy pathgulpfile.js
File metadata and controls
60 lines (53 loc) · 1.57 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
60
var del = require('del');
const gulp = require('gulp');
const gulpTsLint = require('gulp-tslint');
const sourcemaps = require('gulp-sourcemaps');
const mocha = require('gulp-spawn-mocha');
const ts = require('gulp-typescript');
const tslint = require('tslint');
var remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
const tsProject = ts.createProject('tsconfig.json');
gulp.task('clean', () => {
return del(['coverage', 'lib']);
});
gulp.task('default', ['lint', 'scripts', 'test', 'coverage'], () => {});
gulp.task('scripts', () => {
return gulp.src(['src/**/*.ts', 'test/**/*.ts'], { base: '.' })
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(sourcemaps.write('.', {
sourceRoot: '..',
}))
.pipe(gulp.dest('lib'));
});
gulp.task('lint', ['scripts'], () => {
return gulp.src(['src/**/*.ts', 'test/**/*.ts'])
.pipe(gulpTsLint({
configuration: './tslint.json',
formatter: 'verbose',
program: tslint.Linter.createProgram('./tsconfig.json'),
tslint: tslint,
}))
.pipe(gulpTsLint.report({
emitError: false,
summarizeFailureOutput: true,
}));
});
gulp.task('coverage', ['test'], () => {
return gulp.src('coverage/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'text': null,
'text-summary': null,
'html': 'coverage/html-report',
'json': 'coverage/coverage-remapped.json',
}
}));
});
gulp.task('test', ['scripts'], () =>
gulp.src('lib/test/**/*.js', {read: false})
.pipe(mocha({
istanbul: true,
timeout: 15000,
}))
);