Skip to content

Commit 4c99336

Browse files
committed
build: allow running tests inside of a container
Some of the tests have a hard time on modern macOS, mostly because of how Bazel handles file paths with whitespace. By running those tests inside of a Linux container, they can pass. Longer term, it would be great if running all tests outside of Linux would work but that's a taller order.
1 parent 82b0464 commit 4c99336

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.ng-dev/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:22
2+
3+
RUN apt-get update && apt-get install -y \
4+
vim \
5+
less \
6+
chromium
7+
8+
ENV CHROME_BIN "/usr/bin/chromium"
9+
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/chromium"
10+
11+
USER node

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_BIN === '/usr/bin/chromium' ? ['--no-sandbox'] : []),
51+
],
4952
},
5053
},
5154
singleRun: false,

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"lint": "eslint --cache --max-warnings=0 \"**/*.@(ts|mts|cts)\"",
1919
"templates": "yarn admin templates",
2020
"validate": "yarn admin validate",
21-
"postinstall": "yarn webdriver-update && yarn husky",
21+
"postinstall": "yarn webdriver-update-if-possible && yarn husky",
2222
"//webdriver-update-README": "ChromeDriver version must match Puppeteer Chromium version, see https://github.com/GoogleChrome/puppeteer/releases http://chromedriver.chromium.org/downloads",
23+
"webdriver-update-if-possible": "test -x /usr/bin/chromium || yarn webdriver-update",
2324
"webdriver-update": "webdriver-manager update --standalone false --gecko false --versions.chrome 106.0.5249.21",
2425
"public-api:check": "node goldens/public-api/manage.js test",
2526
"ng-dev": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only node_modules/@angular/ng-dev/bundles/cli.mjs",

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_BIN === '/usr/bin/chromium' ? ['--no-sandbox'] : []),
46+
],
4447
}
4548
},
4649
singleRun: false

0 commit comments

Comments
 (0)