👷 Split unit-bs CI job per browser#4623
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: a311531 | Docs | Datadog PR Page | Give us feedback! |
533c184 to
61066db
Compare
763ce7c to
e0a2b44
Compare
e0a2b44 to
a311531
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a311531a23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| browsers: browserConfigurations.map((configuration) => configuration.sessionName), | ||
| concurrency: 5, | ||
| browsers: filteredConfigurations.map((configuration) => configuration.sessionName), | ||
| concurrency: 1, |
There was a problem hiding this comment.
Restore full-run BrowserStack concurrency
When BS_BROWSER is unset (the documented backward-compatible yarn test:unit:bs / ci-bs.ts test:unit path), filteredConfigurations still contains all five BrowserStack launchers but this now forces concurrency to 1. That makes the full BrowserStack run execute the five browsers serially instead of the previous concurrency: 5, so the fallback/local full run no longer behaves “as before” and takes roughly five times longer; keep 1 only for the single-browser filtered case.
Useful? React with 👍 / 👎.
| import { browserConfigurations } from './browsers.conf.ts' | ||
| import karmaBaseConf from './karma.base.conf.js' | ||
|
|
||
| const selectedBrowser = process.env.BS_BROWSER |
There was a problem hiding this comment.
❓ question: would it be possible to use parseArgs here, so we don't need to read it in ci-bs.ts and pass it here as env variable?
| // Override CI_JOB_NAME so getTestReportDirectory() produces a per-browser path | ||
| // (e.g. test-report/unit-bs-firefox/) instead of sharing test-report/unit-bs/ across all browsers. | ||
| environment.CI_JOB_NAME = `unit-bs-${browser}` |
There was a problem hiding this comment.
💬 suggestion: I'd rather not mutate gitlab's build in environment variables.
Instead, and for consistency, I would do like for the e2e: keep the folder name unit-bs as normalized by getTestReportDirectory() and only change the filename of the report:
would become:
junitReporter: {
outputDir: testReportDirectory,
outputFile: process.env.BS_BROWSER ? `results-${process.env.BS_BROWSER}.xml` : 'results.xml'
},
| artifacts: | ||
| reports: | ||
| junit: test-report/unit-bs/*.xml | ||
| junit: test-report/unit-bs-$BS_BROWSER/*.xml |
There was a problem hiding this comment.
| junit: test-report/unit-bs-$BS_BROWSER/*.xml | |
| junit: test-report/unit-bs/*.xml |
| - node scripts/test/ci-bs.ts test:unit --browser $BS_BROWSER | ||
| after_script: | ||
| - node ./scripts/test/export-test-result.ts unit-bs | ||
| - node ./scripts/test/export-test-result.ts unit-bs-$BS_BROWSER |
There was a problem hiding this comment.
| - node ./scripts/test/export-test-result.ts unit-bs-$BS_BROWSER | |
| - node ./scripts/test/export-test-result.ts unit-bs |
thomas-lebeau
left a comment
There was a problem hiding this comment.
hmm, bs-wrapper.ts also checks that there is only one BS job at a time running.
This can make these job wait longer than necessary: (example)
2026-05-15T12:43:32.881957Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:44:02.930861Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:44:32.951962Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:45:03.482930Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:45:33.517166Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:46:03.548156Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:46:33.586724Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:47:03.618851Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:47:33.653588Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:48:03.683845Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:48:33.716840Z 01O �[32;1mOther build running, waiting...�[0m
2026-05-15T12:49:03.758851Z 01O �[32;1mStarting BrowserStackLocal...�[0m
I think there is another BS api that can return you the number of seats occupied, maybe we should use that instead instead of just hasRunningBuild
Motivation
The
unit-bsjob runs all 5 browsers in a single Karma process. If one browser is unavailable on BrowserStack, the whole job fails and you lose the results from the other 4.Changes
Each browser now runs as a separate CI job using
parallel: matrix. The--browserflag onci-bs.tsfilters the Karma config to a single browser. Resource groups are per-browser so they don't serialize against each other. JUnit reports are written to per-browser directories to avoid collisions. Without--browser, all 5 browsers run as before.Test instructions
Checklist