This repository has been archived by the owner on Mar 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 220
/
gulpfile.js
76 lines (63 loc) · 1.69 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
71
72
73
74
75
76
//
// Copyright (C) Microsoft. All rights reserved.
//
'use strict'
const gulp = require('gulp')
const mocha = require('gulp-mocha')
const gtslint = require('gulp-tslint')
const ts = require('gulp-typescript')
const log = require('fancy-log')
const tslint = require('tslint');
const program = tslint.Linter.createProgram("./tsconfig.json", ".");
const shellSources = [
'src/**/*.ts',
'test/**/*.ts',
'test/*.ts',
'typings/globals/**/*.ts',
'!src/**/*.json'
]
const lintSources = [
'src/**/*.ts',
'test/**/*.ts'
]
let isWatch = false
gulp.task('build', function () {
var tsProject = ts.createProject('tsconfig.json')
return gulp.src(shellSources, { base: '' })
.pipe(tsProject())
.pipe(gulp.dest('./out'))
})
gulp.task('build-tests', function () {
const sources = [
'test/**/*.ts',
'test/*.ts'
]
var tsProject = ts.createProject('tsconfig.json')
return gulp.src(shellSources, { base: '' })
.pipe(tsProject())
.pipe(gulp.dest('./out/test'))
})
gulp.task('lint', function () {
return gulp.src(lintSources)
.pipe(gtslint({
formatter: 'verbose',
program: program
}))
// .pipe(gtslint.report())
})
gulp.task('test', gulp.series('build-tests', function () {
process.env.NODE_ENV = 'development'
return gulp.src('out/test/**/*.test.js', { read: false })
.pipe(mocha({ ui: 'tdd' }))
.on('error', function (e) {
log(e ? e.toString() : 'error in test task!')
this.emit('end')
})
}))
gulp.task('watch-test', gulp.series('build-tests', function () {
return gulp.watch(shellSources, gulp.task('test'))
}))
gulp.task('watch', gulp.series('build', function () {
const all = shellSources
gulp.watch(all, gulp.task('build'))
}))