karma-babel-preprocessor

RegeneratorRuntime is not defined

陌路散爱 提交于 2019-11-28 21:07:43
I am trying to run Karma-babel-preprocessor and a straight forward ES6 generator: //require('babel/polyfill'); describe("how Generators work", function() { it("will allow generator functions", function() { /*function * numbers() { yield 1; yield 2; yield 3; };*/ let numbers = { [Symbol.iterator]:function*(){ yield 1; yield 2; yield 3; } } let sum = 0; for(n of numbers){ sum += n; } expect(sum).toBe(6); }); }); From this I generated my test files (ES6 => ES5) with babel: babel src --watch --out-dir tests Then I run karma start I get error: ReferenceError: regeneratorRuntime is not defined".

RegeneratorRuntime is not defined

随声附和 提交于 2019-11-27 13:42:44
问题 I am trying to run Karma-babel-preprocessor and a straight forward ES6 generator: //require('babel/polyfill'); describe("how Generators work", function() { it("will allow generator functions", function() { /*function * numbers() { yield 1; yield 2; yield 3; };*/ let numbers = { [Symbol.iterator]:function*(){ yield 1; yield 2; yield 3; } } let sum = 0; for(n of numbers){ sum += n; } expect(sum).toBe(6); }); }); From this I generated my test files (ES6 => ES5) with babel: babel src --watch -