From 80ee9f2e522ff53b77c432fda3348882e318917a Mon Sep 17 00:00:00 2001 From: Martijn van de Rijdt Date: Thu, 25 May 2017 16:38:11 -0600 Subject: [PATCH] changed: switched from PhantomJS to Chrome headless testing --- .travis.yml | 11 ++++++++- Gruntfile.js | 37 ++++++++++++---------------- package.json | 13 ++++------ test/spec/functions-openrosa.spec.js | 5 ++-- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ca3727..e2ff479 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,15 @@ sudo: false +dist: trusty language: node_js node_js: - - "4" + - "6" +addons: + apt: + packages: + - google-chrome-stable before_script: - npm install -g grunt-cli + # next 3 lines temporary until google-chrome-stable is 59+ + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start & + - sleep 3 diff --git a/Gruntfile.js b/Gruntfile.js index 6dd4cf0..35247d6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,9 +3,7 @@ module.exports = function(grunt) { - require('time-grunt')(grunt); - - grunt.initConfig({ + grunt.initConfig({ clean: { dist: { @@ -43,28 +41,26 @@ module.exports = function(grunt) { } }, - karma: { - options: { - singleRun: true, - reporters: ['dots'] - }, - headless: { - configFile: 'test/karma.conf.js', - browsers: ['PhantomJS'] - }, - browsers: { - configFile: 'test/karma.conf.js', - browsers: ['Chrome', 'Firefox', 'Safari', 'Opera'] - } - } - }); + karma: { + options: { + singleRun: true, + reporters: ['dots'], + configFile: 'test/karma.conf.js', + }, + headless: { + browsers: ['ChromeHeadless'] + }, + browsers: { + browsers: ['Chrome', 'Firefox', 'Safari', 'Opera'] + } + } + }); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-peg'); - grunt.loadNpmTasks('grunt-karma'); - grunt.loadNpmTasks('time-grunt'); + grunt.loadNpmTasks('grunt-karma'); grunt.registerTask('dist', [ 'clean:dist', @@ -73,4 +69,3 @@ module.exports = function(grunt) { 'uglify:dist' ]); }; - diff --git a/package.json b/package.json index c6e4937..694e10c 100644 --- a/package.json +++ b/package.json @@ -21,21 +21,18 @@ "chai": "2.x.x", "grunt": "1.0.x", "grunt-karma": "2.0.x", - "grunt-mocha-test": "0.13.x", - "karma": "1.5.x", + "karma": "1.7.x", "karma-chai": "0.1.x", - "karma-chrome-launcher": "2.0.x", + "karma-chrome-launcher": "2.1.x", "karma-firefox-launcher": "1.0.x", "karma-mocha": "1.3.x", "karma-opera-launcher": "1.0.x", - "karma-phantomjs-launcher": "1.0.x", "karma-safari-launcher": "1.0.x", - "mocha": "3.2.x", - "phantomjs-prebuilt": "2.1.x", + "mocha": "3.4.x", "time-grunt": "1.4.x", - "grunt-contrib-clean": "1.0.x", + "grunt-contrib-clean": "1.1.x", "grunt-contrib-concat": "1.0.x", - "grunt-contrib-uglify": "2.2.x", + "grunt-contrib-uglify": "3.0.x", "grunt-peg": "2.0.1" } } diff --git a/test/spec/functions-openrosa.spec.js b/test/spec/functions-openrosa.spec.js index 314f67e..e174b78 100644 --- a/test/spec/functions-openrosa.spec.js +++ b/test/spec/functions-openrosa.spec.js @@ -570,8 +570,7 @@ describe('Custom "OpenRosa" functions', function() { it('log10()', function() { [ - // note this has a tiny rounding error because Math.log10 is not supported in PhantomJS - ['log10(2)', doc, 0.30102999566398114], + ['log10(2)', doc, 0.3010299956639812], ['log10("NaN")', doc, NaN], ['log10("a")', doc, NaN], ].forEach(function(t) { @@ -723,7 +722,7 @@ describe('Custom "OpenRosa" functions', function() { expect(test).to.throw(win.Error); }); - it('abs', function(){ + it('abs', function() { [ ['abs(10.5)', 10.5], ['abs(-10.5)', 10.5],