我用的是杯酒。我有一个deploy任务,它运行在test任务之后。问题是,即使测试失败,deploy任务也会运行。是否只有在测试在gulp中成功时才能运行deploy任务?
gulp.task('test', function() {
return gulp.src('some_test_tile')
.pipe(karma({
configFile: 'karma.conf.js',
action: 'run'
}));
});
gulp.task('deploy', ['test'], function() {
return gulp.src(paths.scripts)
.pipe(gulp.dest(paths.dest));
});我正在使用gulp-karma运行Karma测试。
发布于 2014-03-16 04:28:45
吞咽-业力例子说要添加.on(“错误”,.)在管道到业力之后,并手动抛出错误,以确保如果任何测试失败,则吞咽出口为非零。这样就行了。
发布于 2014-02-25 08:20:25
任务是否在依赖项完成之前运行?确保您的依赖项任务正确使用异步运行提示。
如果任务的fn执行下列操作之一,则任务可以异步执行:
参见API文档上的示例
var gulp = require('gulp');
// takes in a callback so the engine knows when it'll be done
gulp.task('one', function (cb) {
// do stuff -- async or otherwise
cb(err); // if err is not null and not undefined, the run will stop, and note that it failed
});
// identifies a dependent task must be complete before this one begins
gulp.task('two', ['one'], function () {
// task 'one' is done now
});
gulp.task('default', ['one', 'two']);https://stackoverflow.com/questions/22001368
复制相似问题