build(gulp): log test errors but suppress error handling within gulp while in watch mode
if any tasks executed by gulp results in an error, gulp will try hard to show errors. these are usually irelevant in the watch mode. this is why it's ok to supress them except when running in the ci test mode, in which case failing tasks and logging exceptions is helpful. Closes #1881
This commit is contained in:
parent
3969009fe7
commit
47b8b48ee7
47
gulpfile.js
47
gulpfile.js
|
@ -79,7 +79,22 @@ var angularBuilder = {
|
||||||
console.warn(Array(80).join('!'));
|
console.warn(Array(80).join('!'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}())
|
}());
|
||||||
|
|
||||||
|
|
||||||
|
var treatTestErrorsAsFatal = true;
|
||||||
|
|
||||||
|
function runJasmineTests(globs, done) {
|
||||||
|
fork('./tools/traceur-jasmine', globs, {
|
||||||
|
stdio: 'inherit'
|
||||||
|
}).on('close', function jasmineCloseHandler(exitCode) {
|
||||||
|
if (exitCode && treatTestErrorsAsFatal) {
|
||||||
|
done(new Error('Jasmine tests failed'));
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
|
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
|
||||||
var DART_SDK = require('./tools/build/dartdetect')(gulp);
|
var DART_SDK = require('./tools/build/dartdetect')(gulp);
|
||||||
|
@ -306,11 +321,7 @@ function createDocsTasks(publicBuild) {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task(taskPrefix + '/test', function (done) {
|
gulp.task(taskPrefix + '/test', function (done) {
|
||||||
fork('./tools/traceur-jasmine', ['docs/**/*.spec.js'], {
|
runJasmineTests(['docs/**/*.spec.js'], done);
|
||||||
stdio: 'inherit'
|
|
||||||
}).on('close', function (exitCode) {
|
|
||||||
done(exitCode);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task(taskPrefix + '/serve', function() {
|
gulp.task(taskPrefix + '/serve', function() {
|
||||||
|
@ -437,15 +448,14 @@ gulp.task('test.unit.dart/ci', function (done) {
|
||||||
|
|
||||||
|
|
||||||
gulp.task('test.unit.cjs/ci', function(done) {
|
gulp.task('test.unit.cjs/ci', function(done) {
|
||||||
fork('./tools/traceur-jasmine', ['dist/js/cjs/angular2/test/**/*_spec.js'], {
|
runJasmineTests(['dist/js/cjs/angular2/test/**/*_spec.js'], done);
|
||||||
stdio: 'inherit'
|
|
||||||
}).on('close', function (exitCode) {
|
|
||||||
done(exitCode);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
gulp.task('test.unit.cjs', ['build/clean.js', 'build.tools'], function (done) {
|
gulp.task('test.unit.cjs', ['build/clean.js', 'build.tools'], function (neverDone) {
|
||||||
|
|
||||||
|
treatTestErrorsAsFatal = false;
|
||||||
|
|
||||||
var buildAndTest = [
|
var buildAndTest = [
|
||||||
'!build.js.cjs',
|
'!build.js.cjs',
|
||||||
'test.unit.cjs/ci'
|
'test.unit.cjs/ci'
|
||||||
|
@ -456,13 +466,14 @@ gulp.task('test.unit.cjs', ['build/clean.js', 'build.tools'], function (done) {
|
||||||
|
|
||||||
|
|
||||||
gulp.task('test.unit.tools/ci', function(done) {
|
gulp.task('test.unit.tools/ci', function(done) {
|
||||||
fork('./tools/traceur-jasmine', ['dist/tools/**/*.spec.js'], {
|
runJasmineTests(['dist/tools/**/*.spec.js'], done);
|
||||||
stdio: 'inherit'
|
|
||||||
}).on('close', done.bind(null, null));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
gulp.task('test.unit.tools', ['build/clean.tools'], function(done) {
|
gulp.task('test.unit.tools', ['build/clean.tools'], function(done) {
|
||||||
|
|
||||||
|
treatTestErrorsAsFatal = false;
|
||||||
|
|
||||||
var buildAndTest = [
|
var buildAndTest = [
|
||||||
'!build.tools',
|
'!build.tools',
|
||||||
'test.unit.tools/ci'
|
'test.unit.tools/ci'
|
||||||
|
@ -483,11 +494,7 @@ gulp.task('test.server.dart', runServerDartTests(gulp, gulpPlugins, {
|
||||||
// -----------------
|
// -----------------
|
||||||
// test builders
|
// test builders
|
||||||
gulp.task('test.transpiler.unittest', function(done) {
|
gulp.task('test.transpiler.unittest', function(done) {
|
||||||
fork('./tools/traceur-jasmine', ['tools/transpiler/unittest/**/*.js'], {
|
runJasmineTests(['tools/transpiler/unittest/**/*.js'], done);
|
||||||
stdio: 'inherit'
|
|
||||||
}).on('close', function (exitCode) {
|
|
||||||
done(exitCode);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
|
|
Loading…
Reference in New Issue