From db7560c31fed2291c37ab1da288be1053ee60525 Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Fri, 15 Jan 2016 11:15:01 -0800 Subject: [PATCH] [Test] Use PhantomJS to run tests Switch Karma to use PhantomJS to run tests. CI machines no longer need to have Chrome installed. Implemented after changes to build process due to imperative registration. https://github.com/nasa/openmctweb/issues/450 --- karma.conf.js | 2 +- package.json | 3 ++- test-main.js | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index 8ce816223c..636442bc21 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -71,7 +71,7 @@ module.exports = function(config) { // Specify browsers to run tests in. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: [ - 'Chrome' + 'PhantomJS' ], // Code coverage reporting. diff --git a/package.json b/package.json index d325fe5bbe..906a733fea 100644 --- a/package.json +++ b/package.json @@ -17,12 +17,13 @@ "karma-coverage": "^0.5.3", "karma-html-reporter": "^0.2.7", "karma-jasmine": "^0.1.5", - "karma-phantomjs-launcher": "^0.1.4", + "karma-phantomjs-launcher": "^0.2.3", "karma-requirejs": "^0.2.2", "lodash": "^3.10.1", "markdown-toc": "^0.11.7", "marked": "^0.3.5", "mkdirp": "^0.5.1", + "phantomjs": "^1.9.19", "requirejs": "^2.1.17", "split": "^1.0.0" }, diff --git a/test-main.js b/test-main.js index 09edf98545..c73af26887 100644 --- a/test-main.js +++ b/test-main.js @@ -51,5 +51,13 @@ require.config({ deps: allTestFiles, // we have to kickoff jasmine, as it is asynchronous - callback: window.__karma__.start + callback: function () { + var args = [].slice.apply(arguments); + require(['es6-promise'], function (es6Promise) { + if (!window.Promise) { + window.Promise = es6Promise.Promise; + } + window.__karma__.start.apply(window.__karma__, args); + }); + } });