chore(ci): run karma on local headless browsers instead of BrowserStack - #1612
chore(ci): run karma on local headless browsers instead of BrowserStack#1612Essk wants to merge 5 commits into
Conversation
BrowserStack sessions never start, so the unit, playback and playback-min jobs hang until the 6h timeout. No coverage is lost: Safari is already filtered out of the browser list, so BrowserStack only ever supplied Chrome and a Firefox pinned to version 64. The coverage test type already runs on local browsers and passes green on the same runner. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1612 +/- ##
=======================================
Coverage 84.00% 84.00%
=======================================
Files 44 44
Lines 11713 11713
Branches 2625 2625
=======================================
Hits 9840 9840
Misses 1873 1873 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
CI results on this PR: the BrowserStack hang is fixed, but it has uncovered a second, unrelated problem in the Green (previously hung to the 6h timeout, now finish in ~2.5 min):
All three log Still red: Chrome passes ( It then loops through This looks deterministic rather than flaky: it stalled at exactly 781 of 1410 in both the I have deliberately not touched the tests or karma config to force this green. Worth deciding whether to merge this as-is (it takes CI from one green job to three, and turns a 6-hour hang into a 21-minute failure) and track the Firefox |
Without BrowserStack masking it, preferHeadless: false launches non-headless Chrome and Firefox on CI runners. The unit test type is unstable there: Firefox stalls mid-suite in ping-timeout disconnect cycles and Chrome fails three xhr hook tests, while the same build passes fully both locally and under the coverage type. preferHeadless dates to the 2019 generator migration, before headless was the norm. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ore merge)" This reverts commit cca943d.
The unit suite creates a dedicated worker per segment loader per test. Firefox caps dedicated workers at 512 per origin (dom.workers.maxPerDomain) and silently queues creation beyond the cap rather than erroring, so around test 782 a fresh transmuxer worker never starts, its probeTs message is never processed, and the awaited 'appended' event never fires. QUnit has no test timeout, so the suite stalls until karma's no-activity watchdog kills the browser, giving the deterministic disconnect-and-retry failure at ~21 minutes. Chrome has no equivalent cap. The instrumented coverage build passes on Firefox only because it runs slowly enough for GC to reclaim orphaned workers. Raising the pref keeps Firefox in the unit run. Terminating leaked workers in test teardown is the long-term fix. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Root cause of the The unit suite creates a dedicated web worker per segment loader per test. Firefox caps dedicated workers at 512 per origin ( This also explains the apparent paradox that Fix here: a |
|
Looks like the agent I asked to debug this left some "helpful" comments. I'll leave them, as while not the easiest to read they are accurate and leave context for future investigations. However, apologies for the 🤖 spam. |
Description
CI has been red for months, including on the 3.17.5 release push. The
unit,playbackandplayback-minmatrix jobs hang inrun npm testuntil the 6 hour timeout.From the logs, the BrowserStack sessions never start, and karma waits for them forever. Why they never start hasn't been diagnosed — whether the account or credentials behind the
BROWSER_STACK_USERNAME/BROWSER_STACK_ACCESS_KEYsecrets are still valid isn't visible from the repo side. But the hang is avoidable entirely by skipping BrowserStack: with those env vars removed from the job,videojs-generate-karma-configfalls back to local browser detection, which is exactly the configuration thecoveragetest type already runs (it emptiesbrowserstackLaunchers) and passes in about two minutes on the same runner.In our own player stack we've found that testing in real (cloud) browsers really only adds value for Safari-exclusive playback behaviour — native HLS, AirPlay integration and the like — and we've reworked our test stack to use headless browsers everywhere else, which made CI both faster and more stable. In this repo, the BrowserStack setup provides no Safari coverage anyway:
scripts/karma.conf.jsfilters/(Safari|Chromium)/out of the browser list, so the effective BrowserStack set was onlybsChromeplus absFirefoxpinned to version 64 (a 2018 build). Restoring genuine Safari coverage would be worthwhile, but it's a separate piece of work from repairing CI. If the secrets are confirmed working again later, restoring the two env vars restores the old behavior; the BrowserStack launcher plumbing is untouched.Running the suite on current local browsers surfaced two further issues that this PR also fixes:
preferHeadless: false(boilerplate from the 2019 generator migration) made local detection launch headful Chrome and Firefox on the runner. Removed, so the standard headless variants run.unitsuite at exactly test Update rollup to the latest version 🚀 #782. The suite creates a dedicated web worker per segment loader per test, and Firefox caps dedicated workers at 512 per origin (dom.workers.maxPerDomain) — silently queueing creation past the cap rather than erroring. Once crossed, a fresh transmuxer worker never starts, itsprobeTsmessage is never processed, and the awaitedappendedevent never fires; QUnit has no default test timeout, so karma's no-activity watchdog produces a deterministicExecuted 781 of 1410 … DISCONNECTEDretry loop for ~21 minutes. (The instrumentedcoveragebuild passes on Firefox only because it runs slowly enough for GC to reclaim orphaned workers; Chrome has no equivalent cap.) Fixed with aFirefoxHeadlessHighWorkerLimitlauncher that raises the pref. The long-term fix is terminating leaked workers in test teardown, at which point the pref becomes belt-and-braces — proposed as a follow-up rather than blocking the CI repair.Specific Changes proposed
BROWSER_STACK_*env vars from thecijob so karma detects and uses the runner's local browsers.preferHeadless: falsefromscripts/karma.conf.js.FirefoxHeadlessHighWorkerLimitcustom launcher (Firefox withdom.workers.maxPerDomain: 10000) and map it in place of detectedFirefoxHeadless.No changes to the test-type matrix or the Firefox version pin (which is inert without BrowserStack).
Verification
CI_TEST_TYPE=unitwith the final config passes fully on Firefox 153:TOTAL: 1403 SUCCESS; with default prefs it reproduces the CI freeze at exactly test Update rollup to the latest version 🚀 #782. Chrome passes throughout (TOTAL: 2806 SUCCESSacross two instances).pull_requestworkflow runs use the merge ref: all four matrix jobs now pass in 1.5–3 minutes on both Chrome and Firefox.Requirements Checklist
🤖 Generated with Claude Code