Title: fix(rerun): send project-relative spec paths to remote on re-run [SDK-7124] by anish353 · Pull Request #1173 · browserstack/browserstack-cypress-cli · GitHub
Open Graph Title: fix(rerun): send project-relative spec paths to remote on re-run [SDK-7124] by anish353 · Pull Request #1173 · browserstack/browserstack-cypress-cli
X Title: fix(rerun): send project-relative spec paths to remote on re-run [SDK-7124] by anish353 · Pull Request #1173 · browserstack/browserstack-cypress-cli
Description: Summary Follow-up to #1157 on the same ticket. That PR made the CLI select the right specs on a TRA "re-run failed tests"; this one makes the remote machines actually run them. BROWSERSTACK_RERUN_TESTS arrives as bare filenames ("FO-E2E-02.ts, FO-E2E-05.ts"). run_settings is forwarded to the BrowserStack machines verbatim (capabilityHelper.js → obj.run_settings = JSON.stringify(bsConfig.run_settings)), and a bare filename does not resolve against the project root there — so Cypress exits having run no spec at all: Cypress could not run any of the specs in the build since an exception occurred. getNumberOfSpecFiles already resolves those entries against cypressProjectDir (it globs with matchBase: true, which is why the machine count is correct), but it only persisted the resolved list back to run_settings.specs under turboScaleSession. For a normal run the remote kept receiving the unresolvable basenames. What lands here File Change bin/helpers/utils.js New isReRunSpecsSession() — the 3-part observability re-run predicate, now shared by setUserSpecs and getNumberOfSpecFiles so the two cannot drift apart. getNumberOfSpecFiles persists the already-resolved, project-relative paths to run_settings.specs on a re-run. test/unit/bin/helpers/utils.js Regression tests: the re-run case rewrites basenames to project-relative paths; a non-re-run session leaves specs untouched. Scoped deliberately: this is an else if on the re-run predicate, not a blanket write-back. A plain --spec glob (e.g. cypress/tests/FlightOffer/*) is still forwarded verbatim rather than being expanded into an explicit file list. Verification Reproduced and verified on real BrowserStack builds with a 5-spec suite (3 passing / 2 failing), using the customer's command shape (--sync --spec "cypress/tests/FlightOffer/*"): Run CLI BROWSERSTACK_RERUN_TESTS Result Build 1 1.36.17 — (baseline) 3 passed / 2 failed 0519457f… 2 1.36.17 absent all 5 re-ran (the reported symptom) 75c45973… 3, 5 1.36.17 basenames 2 machines picked, 0 specs executed — deterministic 2/2 1e9ce9bf…, a6b73ce4… 4 1.36.17 project-relative paths exactly the 2 failed specs ran f5440dfc… 7 this branch basenames (identical input to 3/5) exactly the 2 failed specs ran, Total tests: 2 e0786caf… Runs 3/5 → Run 7 is the broken→fixed transition on identical input. Test plan New regression unit tests on getNumberOfSpecFiles — re-run path rewrites to project-relative paths; non-re-run path unchanged. Full test/unit/bin/helpers/utils.js suite: 393 passing on this branch vs 391 on a clean master checkout. The 5 failing (setLocalArgs / setNodeVersion / getVideoConfig ×3) are pre-existing and unrelated — present on clean master too (verified via git stash). In-process check against the real exported functions, including two control cases: a normal --spec glob is preserved verbatim and still matches all 9 specs; a run with no --spec still yields specs: null. Live build with the patched CLI (Run 7 above). Notes / scope Backward compatible: only the observability re-run path is affected; normal runs and TurboScale are untouched. Windows-safe: separators are normalised to /, matching the existing TurboScale branch. Complements #1157 — that PR normalised the comma+space separator, this one resolves the filenames to paths. Both are needed for a re-run to scope correctly end to end. Related, outside this repo: for GitHub Actions the failed-spec env only reaches the runner if the workflow runs browserstack/github-actions/setup-env (v1.0.2+) with a github-token input — GitHub's native re-run API cannot inject env vars. That is a workflow/docs gap tracked separately on the ticket. Release minor patch — bug fix only. Release notes: Fixed BrowserStack "re-run failed tests" on Cypress running the full suite or failing with "could not run any of the specs" — the failed-spec list is now resolved to project-relative paths before it is sent to the BrowserStack machines. Fixes SDK-7124.
Open Graph Description: Summary Follow-up to #1157 on the same ticket. That PR made the CLI select the right specs on a TRA "re-run failed tests"; this one makes the remote machines actually run them. BROWSERSTA...
X Description: Summary Follow-up to #1157 on the same ticket. That PR made the CLI select the right specs on a TRA "re-run failed tests"; this one makes the remote machines actually run them. BR...
Opengraph URL: https://github.com/browserstack/browserstack-cypress-cli/pull/1173
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:255b84aa-173d-de09-231b-77d57e6648ec |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 89BC:298B00:812CF6:B5B817:6B04822C |
| html-safe-nonce | 442af11696e8f88f0e68a95b2555c39a62b8a5adf4346317c37025c7f51dbe65 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUJDOjI5OEIwMDo4MTJDRjY6QjVCODE3OjZCMDQ4MjJDIiwidmlzaXRvcl9pZCI6IjQ3NDU5MzIzMDExNjU0MjkyOTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 766c4645c2797a727b64a72dd0038b90dcb9b3b08c3909529af518f60449d1ba |
| hovercard-subject-tag | pull_request:4250283076 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-cypress-cli/pull/1173/files |
| twitter:image | https://avatars.githubusercontent.com/u/239086185?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/239086185?s=400&v=4 |
| og:image:alt | Summary Follow-up to #1157 on the same ticket. That PR made the CLI select the right specs on a TRA "re-run failed tests"; this one makes the remote machines actually run them. BROWSERSTA... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0366ddfb372682a32e92a5d86155cb08fa83e5bbe79953a968789f2f7e24c511 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-cypress-cli git https://github.com/browserstack/browserstack-cypress-cli.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 242935045 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-cypress-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 242935045 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-cypress-cli |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ed3f2e01f6b7672780c586c8af0e72726374d7b6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width