This is simply to show how to use https://github.com/radify/karma-es6-shim to get Karma unit tests working with ES6 code, PhantomJS and Require.
npm install
gulp
Gulpfile.js
- automation script using the Gulp streaming build system. This compiles the code to ES5 and also runs the tests.src/Example.js
- a basic object that we can testsrc/ExampleController.js
- an AngularJS controller that we can testspec/karma.conf.js
- configuration for the Karma test runnerspec/test-main.js
- configuration for Require so that theimport
statements work correctlyspec/ExampleSpec.js
- a Jasmine spec that testssrc/Example.js
, which Karma runsspec/ExampleControllerSpec.js
- a Jasmine spec that tests the AngularJS code insrc/ExampleController.js
, which Karma runs using PhantomJS