-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Command
test
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
I tried adding firefox to the list of browsers my project uses to test (by adding it to browsers in angular.json - no vitest config file), and while that worked fine locally, I kept getting failures with errors like this when run as a GitHub Action:
⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
Error: Failed to connect to the browser session "3dd515f1-7d40-487e-95d7-a00aa592d1c4" [efis-editor (firefox)] within the timeout.
❯ Timeout._onTimeout node_modules/vitest/dist/chunks/cli-api.BUXBO6jS.js:464:33
❯ listOnTimeout node:internal/timers:581:17
❯ processTimers node:internal/timers:519:7
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
(full run)
When I asked Antigravity to fix that, it came up with an interesting fix, of unsetting CHROME_BIN - that points me to a potential bug in that CHROME_BIN should not at all interfere with firefox, but does.
I have no idea how this relates to #32699, but the problem seems to happen at least in @angular/build 21.2.3 and 21.2.5. I haven't bisected versions to see if this used to work and stopped.
Minimal Reproduction
- Create a test architect like this in angular.json on any project:
"test": {
"builder": "@angular/build:unit-test",
"options": {
"browsers": ["chromium", "firefox"],
},
},
- Add the playwright browser package and run
npx playwright install --with-deps - Set the
CHROME_BINenvironment variable appropriately ng test --headless --watch=false
Exception or Error
⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
Error: Failed to connect to the browser session "5bc4c8f7-acfc-43ab-ba2e-8f13cc11aab9" [efis-editor (firefox)] within the timeout.
❯ Timeout._onTimeout node_modules/vitest/dist/chunks/cli-api.Bxr1Nn49.js:465:33
❯ listOnTimeout node:internal/timers:581:17
❯ processTimers node:internal/timers:519:7
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Test Files 39 passed (78)
Tests 230 passed (230)
Errors 1 error
Start at 23:05:23
Duration 61.29s (transform 0ms, setup 4.76s, import 7.12s, tests 45.47s, environment 0ms)
HTML Report is generated
You can run npx vite preview --outDir test-results to see the test results.
error during close browserType.launch: Timeout 180000ms exceeded.
Call log:
- <launching> /usr/bin/google-chrome -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-dgrNf3 -juggler-pipe -silent
- <launched> pid=3286
- [pid=3286][err] [3286:3326:0327/230525.606556:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
- [pid=3286][err] [3286:3326:0327/230525.815826:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
- [pid=3286][err] [3286:3326:0327/230525.844189:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
- [pid=3286][err] [3383:3383:0327/230525.861827:ERROR:base/memory/shared_memory_switch.cc:289] Failed global descriptor lookup: 7
- [pid=3286][err] [3286:3286:0327/230525.961149:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
- [pid=3286][err] [3286:3286:0327/230525.962452:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
- [pid=3286][err] [3286:3286:0327/230525.963057:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
- [pid=3286][err] [3286:3326:0327/230525.964778:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
- [pid=3286][err] [3286:3286:0327/230526.014785:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
- [pid=3286][err] [3286:3286:0327/230526.039595:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.Properties.GetAll: object_path= /org/freedesktop/UPower/devices/DisplayDevice: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
- [pid=3286][err] [3286:3329:0327/230528.507341:ERROR:google_apis/gcm/engine/registration_request.cc:291] Registration response error message: DEPRECATED_ENDPOINT
- [pid=3286][err] [3286:3329:0327/230528.523406:ERROR:google_apis/gcm/engine/registration_request.cc:291] Registration response error message: PHONE_REGISTRATION_ERROR
- [pid=3286][err] Created TensorFlow Lite XNNPACK delegate for CPU.
- [pid=3286][err] [3286:3329:0327/230548.999734:ERROR:google_apis/gcm/engine/registration_request.cc:291] Registration response error message: DEPRECATED_ENDPOINT
- [pid=3286][err] [3286:3329:0327/230631.566116:ERROR:google_apis/gcm/engine/registration_request.cc:291] Registration response error message: DEPRECATED_ENDPOINT
- [pid=3286][err] [3286:3329:0327/230817.271908:ERROR:google_apis/gcm/engine/registration_request.cc:291] Registration response error message: DEPRECATED_ENDPOINT
at /home/runner/work/efis-editor/efis-editor/node_modules/@vitest/browser-playwright/dist/index.js:929:55 {
name: 'TimeoutError'
}
([full run](https://github.com/rdamazio/efis-editor/actions/runs/23671150296/job/68964795370))
Your Environment
Tried with both:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.2.3
Angular : 21.2.5
Node.js : 25.8.0 (Unsupported)
Package Manager : npm 11.11.0
Operating System : darwin arm64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 21.2.5 │ ^21.2.5 │
│ @angular/build │ 21.2.3 │ ^21.2.3 │
│ @angular/cdk │ 21.2.4 │ ^21.2.4 │
│ @angular/cli │ 21.2.3 │ ^21.2.3 │
│ @angular/common │ 21.2.5 │ ^21.2.5 │
│ @angular/compiler │ 21.2.5 │ ^21.2.5 │
│ @angular/compiler-cli │ 21.2.5 │ ^21.2.5 │
│ @angular/core │ 21.2.5 │ ^21.2.5 │
│ @angular/forms │ 21.2.5 │ ^21.2.5 │
│ @angular/material │ 21.2.4 │ ^21.2.4 │
│ @angular/platform-browser │ 21.2.5 │ ^21.2.5 │
│ @angular/platform-browser-dynamic │ 21.2.5 │ ^21.2.5 │
│ @angular/platform-server │ 21.2.5 │ ^21.2.5 │
│ @angular/router │ 21.2.5 │ ^21.2.5 │
│ @angular/service-worker │ 21.2.5 │ ^21.2.5 │
│ @angular/ssr │ 21.2.3 │ ^21.2.3 │
│ rxjs │ 7.8.2 │ ~7.8.2 │
│ typescript │ 5.9.3 │ ~5.9.3 │
│ vitest │ 4.1.1 │ ^4.0.18 │
│ zone.js │ 0.16.1 │ ^0.16.1 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
and
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.2.5
Angular : 21.2.6
Node.js : 25.8.0 (Unsupported)
Package Manager : npm 11.11.0
Operating System : darwin arm64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 21.2.6 │ ^21.2.6 │
│ @angular/build │ 21.2.5 │ ^21.2.5 │
│ @angular/cdk │ 21.2.4 │ ^21.2.4 │
│ @angular/cli │ 21.2.5 │ ^21.2.5 │
│ @angular/common │ 21.2.6 │ ^21.2.6 │
│ @angular/compiler │ 21.2.6 │ ^21.2.6 │
│ @angular/compiler-cli │ 21.2.6 │ ^21.2.6 │
│ @angular/core │ 21.2.6 │ ^21.2.6 │
│ @angular/forms │ 21.2.6 │ ^21.2.6 │
│ @angular/material │ 21.2.4 │ ^21.2.4 │
│ @angular/platform-browser │ 21.2.6 │ ^21.2.6 │
│ @angular/platform-browser-dynamic │ 21.2.6 │ ^21.2.6 │
│ @angular/platform-server │ 21.2.6 │ ^21.2.6 │
│ @angular/router │ 21.2.6 │ ^21.2.6 │
│ @angular/service-worker │ 21.2.6 │ ^21.2.6 │
│ @angular/ssr │ 21.2.5 │ ^21.2.5 │
│ rxjs │ 7.8.2 │ ~7.8.2 │
│ typescript │ 5.9.3 │ ~5.9.3 │
│ vitest │ 4.1.2 │ ^4.0.18 │
│ zone.js │ 0.16.1 │ ^0.16.1 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
(I did notice the unsupported Node version, and tried with 24.14.1 too, but the same thing happened)
Anything else relevant?
Here's what Gemini said about it while making that fix:
I've found the root cause of the confusing timeout behavior on GitHub Actions, and it explains everything we've seen so far!
Through carefully analyzing the log you grabbed and comparing the environment setup to how @angular/build:unit-test operates, I found out Playwright was trying to launch /usr/bin/google-chrome to run your Firefox tests!
**What went wrong?**
The GitHub Actions ubuntu-latest runner automatically defines an environment variable called CHROME_BIN=/usr/bin/google-chrome for backwards compatibility with Karma setups.
The Angular CLI unit-testing builder (@angular/build:unit-test), which manages Vitest under the hood, has an opinionated setup for Playwright:
If it detects CHROME_BIN, it hardcodes whatever path is inside that variable directly into Playwright's global launchOptions.executablePath.
Because Playwright was globally told to use /usr/bin/google-chrome for everything, it literally attempted to launch Chrome when it came time to test Firefox. It fed Chrome the Firefox-specific CLI flags (-no-remote, -headless, -profile instead of --user-data-dir, and -juggler-pipe), which Chrome doesn't understand.
This leads to DBUS/GPU connection crashes and eventually the 120s connectTimeout from Vitest (which was then followed by Playwright itself crashing out with a 180s browser launch timeout).
This perfectly explains why your tests succeed locally: in your local macOS environment, CHROME_BIN is not explicitly set, so the builder falls back correctly and lets Playwright launch the .cache/ms-playwright managed binaries for both Chromium and Firefox.
The Fix
To ensure this environmental hiccup doesn't affect your runs anymore, I've cleared CHROME_BIN right before calling ng test --headless inside your GitHub Actions workflow file.
I updated .github/workflows/angular-ci.yml (for both test:headless and test:coverage):
For my GitHub action, the fix it made was effectively to change:
- name: Run tests
run: ng test --headless
to
- name: Run tests
run: ng test --headless
env:
CHROME_BIN: ''