]> source.dussan.org Git - jquery.git/commitdiff
Build: Don't require sudo on Travis, use sandboxless headless Chrome
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 19 Mar 2018 17:12:23 +0000 (18:12 +0100)
committerGitHub <noreply@github.com>
Mon, 19 Mar 2018 17:12:23 +0000 (18:12 +0100)
The Chrome sandbox doesn't work on Travis unless sudo is enabled. Instead,
we're disabling the Chrome sandbox.

Closes gh-4011

.travis.yml
Gruntfile.js

index 4ac42174e6113d318948f1a21a3c06349f1c33cd..4fa82ae7ac8b92dc0b0d5e78bec0cc16b1d7262e 100644 (file)
@@ -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"
index a0e90771512ea9d0573124a499fcf2e373afd29c..fbf9b56717a49ebcf940f54c544899752ba644b7 100644 (file)
@@ -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: