fix(rerun): honour BROWSERSTACK_RERUN_TESTS so only failed specs re-run [SDK-7124] - #1157
Open
osho-20 wants to merge 1 commit into
Open
fix(rerun): honour BROWSERSTACK_RERUN_TESTS so only failed specs re-run [SDK-7124]#1157osho-20 wants to merge 1 commit into
osho-20 wants to merge 1 commit into
Conversation
…ed specs re-run [SDK-7124]
obs-api sends the failed-spec list comma+space separated ("a.ts, b.ts"). setUserSpecs
assigned it to run_settings.specs verbatim, unlike the other spec sources which run it
through fixCommaSeparatedString. sanitizeSpecsPattern then built "{a.ts, b.ts}" whose
space-prefixed brace alternatives never match, so the failed-spec filter collapsed and
the whole suite re-ran. Same space-sensitivity in the local runCypressTestsLocally path
(cypress --spec). Normalise in both places.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
✅ Good to go
↻ This verdict comment is the review anchor — it's updated in place on each run (the gate posts its status separately). — SDK PR Review Agent |
xxshubhamxx
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TRA dashboard Re-run → failed tests only was re-running the whole Cypress suite for EasyJet (browserstack-cypress-cli 1.36.13, GitHub Actions). Root cause is a spec-list format bug in the CLI: obs-api passes the failed specs comma+space separated (
BROWSERSTACK_RERUN_TESTS="a.ts, b.ts"), but the re-run code path fed that raw string into the spec glob without stripping the spaces — so the glob never matched the intended specs and the run fell back to the full suite.What lands here
bin/helpers/utils.jssetUserSpecs— routeBROWSERSTACK_RERUN_TESTSthroughfixCommaSeparatedString(the same normalisation every other spec source already gets) before assigningrun_settings.specs.bin/testObservability/helper/helper.jsgetReRunSpecs(localcypress runpath) — trim each entry of the rerun list before passing tocypress --spec, where a leading space silently drops every spec but the first.test/unit/bin/helpers/utils.jssetUserSpecsusing the ticket's exact 5-spec value.Why the whole suite ran
sanitizeSpecsPatternwraps a multi-comma spec string in braces for glob. With the raw value it produced:Brace alternatives keep the leading space (
" FO-E2E-02.ts"), so only the first (space-free) alternative can match. Locally the glob resolves 1/5; on BrowserStack the malformed pattern resolves to nothing and the runner falls back to the full suite — the "every spec re-ran" symptom in the ticket (child build 141199119 ran all 9 specs, incl. 4 never in the payload).After normalisation the pattern is
{FO-E2E-05.ts,FO-E2E-02.ts,...}and resolves to exactly the 5 failed specs.Test plan
setUserSpecs…SDK-7124) — fails on the pre-fix line (asserts the space-mangled string), passes after the fix.test/unit/bin/helpers/utils.jssuite: 391 passing (was 390) — the +1 is this test; the 5 failing (setLocalArgs/setNodeVersion/getVideoConfig) are pre-existing and unrelated (present on a cleanmastercheckout too).glob@7+ the verbatimsanitizeSpecsPattern/fixCommaSeparatedString: pre-fix matches 1/9, post-fix matches exactly the 5 failed specs.Notes / scope
fixCommaSeparatedStringis a no-op on already-clean lists; non-rerun runs are unaffected.Release
Fixes SDK-7124.