-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGulpfile.js
40 lines (35 loc) · 1.1 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
"use strict";
const gulp = require('gulp');
const watch = require('gulp-watch');
const fork = require('child_process').fork;
let restartProcess = function (command) {
if (restartProcess.ls) {
console.log('Restarting...')
restartProcess.ls.kill();
restartProcess.ls = null;
}
let options = {
cwd: process.env.PWD + '/',
env: process.env,
silent: false
};
restartProcess.ls = fork(command, options);
}
process.on('uncaughtException', function (exception) {
console.error(exception);
process.exit(1);
});
process.on('unhandledRejection', (reason, p) => {
console.error("Unhandled Rejection at: Promise:", p, " reason: ", reason);
process.exit(1);
});
gulp.task('tests', function () {
let ls = null;
let command = `${process.env['PWD']}/spec/testRunner.js`;
restartProcess(command);
// Callback mode, useful if any plugin in the pipeline depends on the `end`/`flush` event
return watch(['src/**/*.js', 'spec/**/*.js', 'botbuilder-formflow.js', 'testRunner.js', 'config/**/*.json'], function () {
console.log('Restarting Tests');
restartProcess(command);
});
});