diff --git a/.travis.yml b/.travis.yml index 8a4cb73..d3da6e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ language: node_js node_js: ["0.10"] +before_install: + - export CHROME_BIN=chromium-browser + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start before_script: - npm install -g bower gulp - bower install diff --git a/dist/angular-zendesk-widget.js b/dist/angular-zendesk-widget.js index b1fc16d..640c54f 100644 --- a/dist/angular-zendesk-widget.js +++ b/dist/angular-zendesk-widget.js @@ -10,13 +10,12 @@ } var window = $window; + // Following is essentially a copy paste of JS portion of the Zendesk embed code // with our settings subbed in. For more info, see: // https://support.zendesk.com/hc/en-us/articles/203908456-Using-Web-Widget-to-embed-customer-service-in-your-website - // Note that JSHint ignore is not working in latest release, so can't actually turn - // on JSHint yet. See https://github.com/jshint/jshint/issues/2411 - /* jshint ignore:start */ + /*eslint-disable */ window.zEmbed || function(e, t) { var n, o, d, i, s, a = [], @@ -35,7 +34,7 @@ }, o.write(''), o.close() }("https://assets.zendesk.com/embeddable_framework/main.js", zendeskWidgetSettings.accountUrl); - /* jshint ignore:end */ + /*eslint-enable */ $window.zE(function() { zendeskWidgetSettings.beforePageLoad($window.zE); diff --git a/gulpfile.js b/gulpfile.js index 9ba5d88..2fecf86 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -72,7 +72,8 @@ gulp.task('lint', function () { module: true, require: true, __dirname: true, - document: true + document: true, + process: true } })) // Outputs the results to the console diff --git a/karma-dist-concatenated.conf.js b/karma-dist-concatenated.conf.js index ad8cf85..9dbe80d 100644 --- a/karma-dist-concatenated.conf.js +++ b/karma-dist-concatenated.conf.js @@ -10,16 +10,13 @@ module.exports = function(config) { // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['mocha', 'chai-jquery', 'jquery-1.8.3', 'sinon-chai'], + frameworks: ['jasmine'], plugins: [ - 'karma-mocha', - 'karma-chai', + 'karma-jasmine', 'karma-sinon-chai', 'karma-chrome-launcher', - 'karma-phantomjs-launcher', - 'karma-jquery', - 'karma-chai-jquery' + 'karma-spec-reporter' ], // list of files / patterns to load in the browser @@ -67,11 +64,25 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], + browsers: ['Chrome'], + + + // Use a custom launcher to run Chrome on TravisCI + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); + + // Switch browser to Chrome if TravisCI is detected + if (process.env.TRAVIS) { + config.browsers = ['Chrome_travis_ci']; + } }; diff --git a/karma-dist-minified.conf.js b/karma-dist-minified.conf.js index bf58e54..62981da 100644 --- a/karma-dist-minified.conf.js +++ b/karma-dist-minified.conf.js @@ -10,16 +10,13 @@ module.exports = function(config) { // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['mocha', 'chai-jquery', 'jquery-1.8.3', 'sinon-chai'], + frameworks: ['jasmine'], plugins: [ - 'karma-mocha', - 'karma-chai', + 'karma-jasmine', 'karma-sinon-chai', 'karma-chrome-launcher', - 'karma-phantomjs-launcher', - 'karma-jquery', - 'karma-chai-jquery' + 'karma-spec-reporter' ], // list of files / patterns to load in the browser @@ -67,11 +64,24 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], + browsers: ['Chrome'], + // Use a custom launcher to run Chrome on TravisCI + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); + + // Switch browser to Chrome if TravisCI is detected + if (process.env.TRAVIS) { + config.browsers = ['Chrome_travis_ci']; + } }; diff --git a/karma-src.conf.js b/karma-src.conf.js index aa48853..5ebae22 100644 --- a/karma-src.conf.js +++ b/karma-src.conf.js @@ -15,7 +15,7 @@ module.exports = function(config) { plugins: [ 'karma-jasmine', 'karma-sinon-chai', - 'karma-phantomjs-launcher', + 'karma-chrome-launcher', 'karma-spec-reporter' ], @@ -65,11 +65,26 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], + browsers: ['Chrome'], + + + // Use a custom launcher to run Chrome on TravisCI + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); + + // Switch browser to Chrome if TravisCI is detected + if (process.env.TRAVIS) { + config.browsers = ['Chrome_travis_ci']; + } }; + diff --git a/package.json b/package.json index 9d7d603..aa2153b 100644 --- a/package.json +++ b/package.json @@ -29,11 +29,8 @@ "karma-chrome-launcher": "^0.1.4", "karma-jasmine": "^0.3.6", "karma-jquery": "^0.1.0", - "karma-mocha": "^0.1.8", - "karma-phantomjs-launcher": "^0.1.4", "karma-sinon-chai": "^0.2.0", "karma-spec-reporter": "^0.0.18", - "mocha": "^1.21.4", "run-sequence": "^1.0.2", "sinon": "^1.10.3", "sinon-chai": "^2.5.0" diff --git a/test/unit/angular-zendesk-widget/zendeskWidgetSpec.js b/test/unit/angular-zendesk-widget/zendeskWidgetSpec.js index 8b01731..2cedd2c 100644 --- a/test/unit/angular-zendesk-widget/zendeskWidgetSpec.js +++ b/test/unit/angular-zendesk-widget/zendeskWidgetSpec.js @@ -8,7 +8,7 @@ describe('Angular Zendesk Widget', function() { module('zendeskWidget'); expect(function() { inject() - }).toThrow(); + }).toThrowError('Missing accountUrl. Please set in app config via ZendeskWidgetProvider'); }); });