Skip to content

Commit

Permalink
test: allow Chrome sandbox opt-out (--no-sandbox)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
jkrems committed Sep 26, 2024
1 parent 4179bf2 commit 3020571
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ module.exports = function(config) {
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--disable-gpu'],
flags: [
'--disable-gpu',
...(process.env.CHROME_NO_SANDBOX === '1' ? ['--no-sandbox'] : []),
],
},
},
singleRun: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ module.exports = function (config) {
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--disable-gpu']
flags: [
'--disable-gpu',
...(process.env.CHROME_NO_SANDBOX === '1' ? ['--no-sandbox'] : []),
],
}
},
singleRun: false
Expand Down

0 comments on commit 3020571

Please sign in to comment.