我是新來的節點並在任何「適當」環境下開發。我已經爲我當前的項目安裝了gulp,還有mocha和其他一些模塊。這裏是我的gulpfile.js:「Finishing」之後的吞嚥掛鉤
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var eslint = require('gulp-eslint');
gulp.task('lint', function() {
return gulp.src(['js/**/*.js'])
// eslint() attaches the lint output to the eslint property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failOnError last.
.pipe(eslint.failOnError());
});
gulp.task('test', function() {
return gulp.src('tests/test.js', {read: false})
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe(mocha({reporter: 'list'}));
});
gulp.task('default', ['lint','test'], function() {
// This will only run if the lint task is successful...
});
當我運行「一飲而盡」,這似乎完成所有工作,但掛起。我必須按Ctrl + C返回到命令提示符。我如何才能正確完成?
您自己運行的任何任務('一飲而盡test','一飲而盡lint'),難道他們掛?我已經在這裏剪切和粘貼你的代碼,並且沒有任何問題可以運行它。沒有東西掛起。 – Louis
我會稍後再試,謝謝。 – Ooberdan