Generator not support? #393

Open
fengmk2 opened this Issue Mar 3, 2014 · 13 comments

Comments

Projects
None yet
9 participants
@fengmk2

fengmk2 commented Mar 3, 2014

I run the coverage test on koa app, it throw:

$ m cov

/Users/mk2/git/koa-gzip/node_modules/blanket/node_modules/esprima/esprima.js:3872
            throw e;
                  ^
Error: Line 27: Unexpected token *
    at throwError (/Users/mk2/git/koa-gzip/node_modules/blanket/node_modules/esprima/esprima.js:1156:21)
    at throwUnexpected (/Users/mk2/git/koa-gzip/node_modules/blanket/node_modules/esprima/esprima.js:1213:9)
@fengmk2

This comment has been minimized.

Show comment
Hide comment
@fengmk2

fengmk2 Mar 3, 2014

Simple test code:

module.exports = function (options) {
  return function *gzip(next) {
    console.log('hello');
  };
};

fengmk2 commented Mar 3, 2014

Simple test code:

module.exports = function (options) {
  return function *gzip(next) {
    console.log('hello');
  };
};
@t3chnoboy

This comment has been minimized.

Show comment
Hide comment
@t3chnoboy

t3chnoboy Mar 30, 2014

+1
Generator support would be great

+1
Generator support would be great

@rschmukler

This comment has been minimized.

Show comment
Hide comment

+1

@constantology

This comment has been minimized.

Show comment
Hide comment

+1

@ilkkao

This comment has been minimized.

Show comment
Hide comment
@ilkkao

ilkkao Jan 20, 2015

ES6 support would be nice. It's becoming more and more popular because of good support in io.js and modern browsers.

ilkkao commented Jan 20, 2015

ES6 support would be nice. It's becoming more and more popular because of good support in io.js and modern browsers.

@markhuge

This comment has been minimized.

Show comment
Hide comment

+1

@ZheFeng

This comment has been minimized.

Show comment
Hide comment

ZheFeng commented Mar 10, 2015

+1

@mattma

This comment has been minimized.

Show comment
Hide comment
@mattma

mattma Mar 11, 2015

+1 same here

mattma commented Mar 11, 2015

+1 same here

@mattma

This comment has been minimized.

Show comment
Hide comment
@mattma

mattma Mar 11, 2015

@fengmk2 Is there an alternative code coverage tool which could run generators?

mattma commented Mar 11, 2015

@fengmk2 Is there an alternative code coverage tool which could run generators?

@alex-seville

This comment has been minimized.

Show comment
Hide comment
@alex-seville

alex-seville Mar 11, 2015

Owner

The parser that Blanket uses has partial support for ES6: http://esprima.org/doc/es6.html

I suspect that Istanbul (https://github.com/gotwarlost/istanbul) is using a more recent version of Esprima then Blanket, but I don't believe it works for client side testing yet.

Owner

alex-seville commented Mar 11, 2015

The parser that Blanket uses has partial support for ES6: http://esprima.org/doc/es6.html

I suspect that Istanbul (https://github.com/gotwarlost/istanbul) is using a more recent version of Esprima then Blanket, but I don't believe it works for client side testing yet.

@mattma

This comment has been minimized.

Show comment
Hide comment
@mattma

mattma Mar 12, 2015

@alex-seville

I actually run Blanket to test my server side application. It works for me when I use Node/Express.js server side javascript testing via gulp-blanket-mocha. Here is the Gulp code.

gulp.task('coverage', function () {
  // Test which need to run again src folder
  // one test per line
  var src = [
    'server/test/routes/api/**/*.spec.js'
  ];
  // Source folder need to be tested on
  // one source per line
  // match what is passing from the `src` array
  var instrument = [
    'server/routes/api/'
  ];

  return gulp.src(src, {read: false})
    .pipe($.blanketMocha({
      instrument:  instrument,
      captureFile: 'coverage.html',
      reporter:    'html-cov'
    }));
});

Then I used the exactly same gulp code above, tried in my newer refactored version Node/Koa.js with the exactly same structure and logic. The only difference is using ES6 generators and Koa.js Coroutine. And the gulp coverage task actually hangs.

I want to take the initiative on building a newer version of the gulp-blanket since the other one seems dead without any activity for over a year now.

If you could help me along the way, it would be awesome.

mattma commented Mar 12, 2015

@alex-seville

I actually run Blanket to test my server side application. It works for me when I use Node/Express.js server side javascript testing via gulp-blanket-mocha. Here is the Gulp code.

gulp.task('coverage', function () {
  // Test which need to run again src folder
  // one test per line
  var src = [
    'server/test/routes/api/**/*.spec.js'
  ];
  // Source folder need to be tested on
  // one source per line
  // match what is passing from the `src` array
  var instrument = [
    'server/routes/api/'
  ];

  return gulp.src(src, {read: false})
    .pipe($.blanketMocha({
      instrument:  instrument,
      captureFile: 'coverage.html',
      reporter:    'html-cov'
    }));
});

Then I used the exactly same gulp code above, tried in my newer refactored version Node/Koa.js with the exactly same structure and logic. The only difference is using ES6 generators and Koa.js Coroutine. And the gulp coverage task actually hangs.

I want to take the initiative on building a newer version of the gulp-blanket since the other one seems dead without any activity for over a year now.

If you could help me along the way, it would be awesome.

@fengmk2

This comment has been minimized.

Show comment
Hide comment
@fengmk2

fengmk2 Mar 12, 2015

@mattma I had switch to istanbul after this issue I added.

fengmk2 commented Mar 12, 2015

@mattma I had switch to istanbul after this issue I added.

@fengmk2

This comment has been minimized.

Show comment
Hide comment

@dcposch dcposch referenced this issue in joebandenburg/libaxolotl-javascript Jan 27, 2016

Open

Remove Traceur, V8-incompatible syntax sugar to run in node directly #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment