Gulp问题和错误

时间:2018-09-19 17:54:31

标签: gulp gulp-jasmine gulp-eslint

我正在尝试通过npm安装eslint和jasmine phantom茉莉花,但我认为一切都无法正常工作。这是我的gulp文件

var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var eslint = require('gulp-eslint');
var jasmine = require('gulp-jasmine-phantom');

browserSync.stream();

gulp.task('default', ['styles', 'lint'], function() {
	gulp.watch('/sass/**/*.scss', gulp.parallel('styles'));
	gulp.watch('js/**/*.js', gulp.parallel('lint'));
	gulp.watch('index.html', browserSync.reload);

	browserSync.init({
		server:"./"
	});
});

gulp.task('styles', function() {
	gulp.src('sass/**/*.scss')
		.pipe(sass().on('error', sass.logError))
		.pipe(autoprefixer({
			browsers: ['last 2 versions']
		}))
		.pipe(gulp.dest('./css'))
});

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 failAfterError last.
        .pipe(eslint.failAfterError());
});

gulp.task('tests', function () {
	gulp.src('tests/spec/extraSpec.js')
	.pipe(jasmine( {
		integration: true,
		vendor: 'js/**/.*js'
	}));
});

这是我运行“ gulp”时遇到的错误

  

$ gulp assert.js:42抛​​出新错误.AssertionError({^

     

AssertionError [ERR_ASSERTION]:必须指定任务功能       在Gulp.set [作为_setTask](C:\ Users \ davek \ OneDrive \ Udacity--Google \ Gulp \ my-project \ node_modules \ undertaker \ lib \ set-task.js:10:3​​)       在Gulp.task(C:\ Users \ davek \ OneDrive \ Udacity--Google \ Gulp \ my-project \ node_modules \ undertaker \ lib \ task.js:13:8)       在对象。 (C:\ Users \ davek \ OneDrive \ Udacity--Google \ Gulp \ my-project \ gulpfile.js:10:6)       在Module._compile(module.js:653:30)       在Object.Module._extensions..js(module.js:664:10)       在Module.load(module.js:566:32)       在tryModuleLoad(module.js:506:12)       在Function.Module._load(module.js:498:3)       在Module.require(module.js:597:17)       在要求时(internal / module.js:11:18)

感谢您的帮助。

戴夫

0 个答案:

没有答案