New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator not support? #393

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

Comments

Projects
None yet
9 participants
@fengmk2
Copy link

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.

Copy link
Author

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.

Copy link

t3chnoboy commented Mar 30, 2014

+1
Generator support would be great

@rschmukler

This comment has been minimized.

Copy link

rschmukler commented Apr 29, 2014

+1

1 similar comment
@constantology

This comment has been minimized.

Copy link

constantology commented Sep 1, 2014

+1

@ilkkao

This comment has been minimized.

Copy link

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.

Copy link

markhuge commented Jan 25, 2015

+1

1 similar comment
@ZheFeng

This comment has been minimized.

Copy link

ZheFeng commented Mar 10, 2015

+1

@mattma

This comment has been minimized.

Copy link

mattma commented Mar 11, 2015

+1 same here

@mattma

This comment has been minimized.

Copy link

mattma commented Mar 11, 2015

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

@alex-seville

This comment has been minimized.

Copy link
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.

Copy link

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.

Copy link
Author

fengmk2 commented Mar 12, 2015

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

@fengmk2

This comment has been minimized.

Copy link
Author

fengmk2 commented Mar 12, 2015

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