相关疑难解决方法(0)

为什么"gulp-jest"失败了:"请运行带有--harmony标志的节点!"?

运行时出现以下错误gulp test:

Error: Please run node with the --harmony flag!
Run Code Online (Sandbox Code Playgroud)

这是我的gulp任务:

var jest = require('gulp-jest');

gulp.task('test', function() {
  return gulp.src('src/**/__tests__').pipe(jest({
    rootDir: 'src',
    scriptPreprocessor: '../node_modules/6to5-jest',
    unmockedModulePathPatterns: [ 'react' ]
  }));
});
Run Code Online (Sandbox Code Playgroud)

重现:https://github.com/SEEK-Jobs/react-playground

请注意,它npm test正常工作(测试按预期gulp test失败),但失败并出现上述错误.双方npm test并gulp test具有相同的配置对象:

{
  rootDir: 'src',
  scriptPreprocessor: '../node_modules/6to5-jest',
  unmockedModulePathPatterns: [ 'react' ]
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

reactjs gulp jestjs gulp-jest

4
推荐指数
1
解决办法
3153
查看次数

标签 统计

gulp ×1

gulp-jest ×1

jestjs ×1

reactjs ×1