forked from DevExpress/testcafe-reporter-dashboard
/
Gulpfile.js
57 lines (45 loc) · 1.37 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
var gulp = require('gulp');
var del = require('del');
var gulpTypeScript = require('gulp-typescript');
function clean (cb) {
return del('lib', cb);
}
function lint () {
return gulp
.src([
'src/**/*.ts',
'test/**/*.ts',
'Gulpfile.js'
])
.pipe(eslint.format())
.pipe(eslint.failAfterError());
}
function build () {
const tsConfig = gulpTypeScript.createProject('tsconfig.json');
return gulp
.src('src/**/*.ts')
.pipe(tsConfig())
.pipe(gulp.dest('lib'));
}
function buildTypes () {
const tsConfig = gulpTypeScript({declaration: true})
return gulp
.src('src/types/*.ts')
.pipe(tsConfig).dts
.pipe(gulp.dest('lib/types/'));
}
function preview () {
var buildReporterPlugin = require('testcafe').embeddingUtils.buildReporterPlugin;
var pluginFactory = require('./lib');
var reporterTestCalls = require('./test/utils/reporter-test-calls');
var plugin = buildReporterPlugin(pluginFactory);
console.log();
reporterTestCalls.forEach(function (call) {
plugin[call.method].apply(plugin, call.args);
});
process.exit(0);
}
exports.clean = clean;
exports.test = gulp.series(clean, build);
exports.build = gulp.series(clean, build, buildTypes);
exports.preview = gulp.series(clean, build, preview);