yield.js 525 B

1234567891011121314151617181920
  1. var browserify = require('../');
  2. var test = require('tap').test;
  3. var vm = require('vm');
  4. var generatorFunction = require('make-generator-function');
  5. test('yield', { skip: !generatorFunction }, function (t) {
  6. t.plan(6);
  7. var b = browserify(__dirname + '/yield/main.js');
  8. b.bundle(function (err, src) {
  9. t.error(err);
  10. var c = { console: { log: log } };
  11. var index = 0;
  12. vm.runInNewContext(src, c);
  13. function log (msg) {
  14. t.equal(index++, msg);
  15. }
  16. });
  17. });