AngularJs testing for mix of ES6 and ES5 codebase

111 views Asked by At

I have recently started using ES6 coding style for AngularJs1.x. Codebase contains both ES6 style coding as well as ES5 style coding. Would like to use ES6 style coding for test specs also. Need help in understanding what config changes needs to done in Karma,protractor Grunt/Gulp files to support ES6 style coding as well as continue supporting existing old style spec code.

1

There are 1 answers

0
abhinav singh On

After some research and try out , below config worked for me.. Used browserify with bebelify transform.

frameworks: ['browserify']

preprocessors: {
      'app/es6/**/*.js':['browserify'],
      'test/unit/es6/**/*.js':['browserify'],
}

browserify: {
      debug: true,
      transform: [["babelify", { "presets": ["es2015"] }]]
    }