From b95e0da68e1e3fce59a6a54c209b893f611b0b9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Mon, 19 Mar 2018 18:12:23 +0100 Subject: [PATCH] Build: Don't require sudo on Travis, use sandboxless headless Chrome The Chrome sandbox doesn't work on Travis unless sudo is enabled. Instead, we're disabling the Chrome sandbox. Closes gh-4011 --- .travis.yml | 6 +----- Gruntfile.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ac42174e..4fa82ae7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ language: node_js -# Temporary workaround. -# Karma can't access the binaries on travis -# without root access. -# See https://github.com/travis-ci/travis-ci/issues/8836 -sudo: required +sudo: false node_js: - "4" - "6" diff --git a/Gruntfile.js b/Gruntfile.js index a0e907715..fbf9b5671 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,7 +13,8 @@ module.exports = function( grunt ) { } var fs = require( "fs" ), - gzip = require( "gzip-js" ); + gzip = require( "gzip-js" ), + isTravis = process.env.TRAVIS; if ( !grunt.option( "filename" ) ) { grunt.option( "filename", "jquery.js" ); @@ -151,6 +152,12 @@ module.exports = function( grunt ) { options: { customContextFile: "test/karma.context.html", customDebugFile: "test/karma.debug.html", + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: "ChromeHeadless", + flags: [ "--no-sandbox" ] + } + }, frameworks: [ "qunit" ], middleware: [ "mockserver" ], plugins: [ @@ -214,7 +221,9 @@ module.exports = function( grunt ) { singleRun: true }, main: { - browsers: [ "ChromeHeadless" ] + + // The Chrome sandbox doesn't work on Travis. + browsers: [ isTravis ? "ChromeHeadlessNoSandbox" : "ChromeHeadless" ] }, // To debug tests with Karma: -- 2.39.5