Skip to content

Commit 3020571

Browse files
committed
test: allow Chrome sandbox opt-out (--no-sandbox)
In some environments, e.g. containers or in some cases macOS, headless Chrome may not work with the sandbox enabled. This exposes an escape hatch to run tests in those environments. Example use: ```sh yarn bazel test \ //packages/angular_devkit/build_angular:build_angular_karma_test \ --test_env=PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \ --test_env=CHROME_NO_SANDBOX=1 ```
1 parent 4179bf2 commit 3020571

File tree

2 files changed

+8
-2
lines changed
  • modules/testing/builder/projects/hello-world-app
  • packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib

2 files changed

+8
-2
lines changed

modules/testing/builder/projects/hello-world-app/karma.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ module.exports = function(config) {
4545
customLaunchers: {
4646
ChromeHeadlessCI: {
4747
base: 'ChromeHeadless',
48-
flags: ['--disable-gpu'],
48+
flags: [
49+
'--disable-gpu',
50+
...(process.env.CHROME_NO_SANDBOX === '1' ? ['--no-sandbox'] : []),
51+
],
4952
},
5053
},
5154
singleRun: false,

packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/karma.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ module.exports = function (config) {
4040
customLaunchers: {
4141
ChromeHeadlessCI: {
4242
base: 'ChromeHeadless',
43-
flags: ['--disable-gpu']
43+
flags: [
44+
'--disable-gpu',
45+
...(process.env.CHROME_NO_SANDBOX === '1' ? ['--no-sandbox'] : []),
46+
],
4447
}
4548
},
4649
singleRun: false

0 commit comments

Comments
 (0)