-
Notifications
You must be signed in to change notification settings - Fork 18
/
Gulpfile.js
56 lines (47 loc) · 1.49 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
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var babel = require('gulp-babel');
var del = require('del');
gulp.task('clean', function (cb) {
del('lib', cb);
});
gulp.task('lint', function () {
return gulp
.src([
'src/**/*.js',
'test/**/*.js',
'Gulpfile.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('build', gulp.series('clean', 'lint', function () {
return gulp
.src('src/**/*.js')
.pipe(babel({
presets: ['@babel/preset-env']
}))
.pipe(gulp.dest('lib'));
}));
gulp.task('test', gulp.series('build', async function () {
const mocha = (await import('gulp-mocha')).default;
return gulp
.src('test/**.js')
.pipe(mocha({
ui: 'bdd',
reporter: 'spec',
timeout: typeof v8debug === 'undefined' ? 2000 : Infinity // NOTE: disable timeouts in debug
}));
}));
gulp.task('preview', gulp.series('build', function (done) {
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);
});
done();
}));