grunt-babel

Run javascript es6 code in Jasmine

两盒软妹~` 提交于 2020-07-03 03:29:08
问题 I am exploring JavaScript es6 code in angularjs app and used grunt babel to compile the es6 to es5. My unit test (jasmine) doesn't run with es6 code using phantomjs. Whats best way to run test? Is there any plugin to use for jasmine to run es6 code? 回答1: You can configure Jasmine to use Babel as a helper and transform your code on the fly. Install babel-register module: npm install --save-dev babel-register And register it as a Jasmine helper In your spec/support/jasmine.json file make the