🌐 AI搜索 & 代理 主页
Skip to content

Commit b95e0da

Browse files
authored
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
1 parent 3652842 commit b95e0da

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
language: node_js
2-
# Temporary workaround.
3-
# Karma can't access the binaries on travis
4-
# without root access.
5-
# See https://github.com/travis-ci/travis-ci/issues/8836
6-
sudo: required
2+
sudo: false
73
node_js:
84
- "4"
95
- "6"

Gruntfile.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module.exports = function( grunt ) {
1313
}
1414

1515
var fs = require( "fs" ),
16-
gzip = require( "gzip-js" );
16+
gzip = require( "gzip-js" ),
17+
isTravis = process.env.TRAVIS;
1718

1819
if ( !grunt.option( "filename" ) ) {
1920
grunt.option( "filename", "jquery.js" );
@@ -151,6 +152,12 @@ module.exports = function( grunt ) {
151152
options: {
152153
customContextFile: "test/karma.context.html",
153154
customDebugFile: "test/karma.debug.html",
155+
customLaunchers: {
156+
ChromeHeadlessNoSandbox: {
157+
base: "ChromeHeadless",
158+
flags: [ "--no-sandbox" ]
159+
}
160+
},
154161
frameworks: [ "qunit" ],
155162
middleware: [ "mockserver" ],
156163
plugins: [
@@ -214,7 +221,9 @@ module.exports = function( grunt ) {
214221
singleRun: true
215222
},
216223
main: {
217-
browsers: [ "ChromeHeadless" ]
224+
225+
// The Chrome sandbox doesn't work on Travis.
226+
browsers: [ isTravis ? "ChromeHeadlessNoSandbox" : "ChromeHeadless" ]
218227
},
219228

220229
// To debug tests with Karma:

0 commit comments

Comments
 (0)