Nerajno / gulp-jest

Gulp plugin for the Jest test lib
MIT License
53 stars 43 forks source link

Error: Please run node with the --harmony flag! #9

Closed moroshko closed 7 years ago

moroshko commented 9 years ago

I get the following error when running gulp test:

Error: Please run node with the --harmony flag!

Here is my gulp task:

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

To reproduce: https://github.com/SEEK-Jobs/react-playground

Note that npm test works properly (test is failing as expected), but gulp test fails with the error above. Both npm test and gulp test have the same config object:

{
  rootDir: 'src',
  scriptPreprocessor: '../node_modules/6to5-jest',
  unmockedModulePathPatterns: [ 'react' ]
}

What am I doing wrong?

Dakuan commented 9 years ago

I think this is a gulp issue, see if https://github.com/gulpjs/gulp/issues/66 helps you

mik01aj commented 9 years ago

I don't think this is a Gulp problem. Imho it's either gulp-jest or jest itself. Look at this:

screenshot 2015-02-11 15 11 15

(I didn't change anything in the editor between these commands, so it looks like a really weird bug that happens only when there is just one test file.)

P.S. Here's the relevant part from my gulpfile - nothing special here.

gulp.task('jest', function () {
    return gulp.src('__tests__').pipe($.jest());
});    
Dakuan commented 9 years ago

Have you seen this fix? http://stackoverflow.com/questions/28315796/why-gulp-jest-is-failing-with-please-run-node-with-the-harmony-flag

mik01aj commented 9 years ago

Works great, thanks! But it would be nice to find the original cause of this, anyway :)

Dakuan commented 9 years ago

Indeed - I'm not convinced that the issue is in gulp-jest.

Do you mind if I close this? @mik01aj @moroshko

mik01aj commented 9 years ago

Yes. I suppose it's a bug in jest-cli and I will report it there.

screenshot 2015-02-11 17 28 35

Dakuan commented 9 years ago

I've shipped an update that includes the latest jest-cli which should resolve this for you. Let me know how you get on!

binarykitchen commented 9 years ago

Still having the same issue, even with your latest version:

Error: Please run node with the --harmony flag! jest requires WeakMap which is only available with the --harmony flag in node < v0.12
joshuacalloway commented 9 years ago

I'm seeing this error too. tried adding this to my gulpfile require('harmonize')();

This works fine with my "grunt jest"

ieugen commented 9 years ago

+1, please add to official docs/npm page

moimikey commented 9 years ago

+1 for require('harmonize')(). not a blocker at all with it, but until they update the npm package with their latest patch, you'll lose your stdout colors =/

screendriver commented 9 years ago

+1 for require('harmonize')()

binarykitchen commented 9 years ago

Since nothing happened, I took the liberty to fork it and make it compatible for the latest iojs: https://www.npmjs.com/package/gulp-jest-iojs

alansouzati commented 8 years ago

Is this still an issue? I'm planning to maintain this library now. let me know if the latest version presents any issues.

alansouzati commented 7 years ago

Closing this issue as there is no activity on it.