我在流中遇到错误. 我正在努力将伊斯坦布尔添加到我现有的mocha任务中.当我运行此任务时,我收到以下错误. 我正在使用gulp-istanbul (注意:config.test.src.bdd.features设置为值’test / bdd / fe
我正在努力将伊斯坦布尔添加到我现有的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时可能没有正确设置这项任务,但试图至少先解决这个错误.
我面临着同样的问题.我相信问题是符合的:
var stream = gulp.src([config.test.src.bdd.features], { read: false });
将read选项设置为false会导致file.contents为null,因此istanbul无法覆盖这些文件. (检查here)
所以尝试相同的东西但没有读取选项.
var stream = gulp.src([config.test.src.bdd.features]);
希望这可以帮助.
