【问题标题】:Gulp streams not supported Error using gulp-istanbul不支持 Gulp 流使用 gulp-istanbul 时出错
【发布时间】:2015-10-28 15:31:26
【问题描述】:

我收到流错误。

我正在努力将伊斯坦布尔添加到我现有的 mocha 任务中。当我运行此任务时,我收到以下错误。

我正在使用gulp-istanbul

(注意:config.test.src.bdd.features 设置为值'test/bdd/features/**/*-spec.js'

var stream = gulp.src([config.test.src.bdd.features], { read: false });

gulp.task('mocha-bdd-features', function(cb) {
    process.env.PORT = 8001;
    return stream
        .pipe(istanbul())
        .pipe(istanbul.hookRequire())
        .pipe(mocha({
            compilers: {
                js: babel
            },
            reporter: config.test.mocha.reporter,
            ui: 'bdd'
        }))
        .on('finish', function () {
            stream.pipe(istanbul.writeReports())
            stream.pipe(istanbul.enforceThresholds({thresholds: {global: 90}}))
            stream.on('end', cb);
        });
});

我得到的错误是:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: streams not supported

谁知道我在尝试合并 gulp-istanbul 时可能没有正确设置此任务,但尝试至少首先克服此错误。

【问题讨论】:

    标签: node.js gulp istanbul


    【解决方案1】:

    我面临着完全相同的问题。 我相信问题出在:

    var stream = gulp.src([config.test.src.bdd.features], { read: false });
    

    read 选项设置为 false 会导致 file.contents 为空,因此 istanbul 无法覆盖这些文件。 (查看here

    所以尝试同样的事情,但没有 read 选项。

    var stream = gulp.src([config.test.src.bdd.features]);
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-28
      • 2021-01-17
      • 2017-11-22
      • 2016-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多