browserstack-cypress-cli 1.36.17 → 1.36.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -491,10 +491,20 @@ exports.setNodeVersion = (bsConfig, args) => {
491
491
  }
492
492
 
493
493
  // specs can be passed from bstack configuration file
494
+ // True when the spec list for this run comes from BROWSERSTACK_RERUN_TESTS rather than
495
+ // the user's config/CLI args. Shared by setUserSpecs and getNumberOfSpecFiles so the two
496
+ // cannot drift apart — getNumberOfSpecFiles rewrites specs only for runs setUserSpecs
497
+ // actually sourced from the re-run env.
498
+ exports.isReRunSpecsSession = () => {
499
+ return o11yHelpers.isBrowserstackInfra()
500
+ && o11yHelpers.isTestObservabilitySession()
501
+ && o11yHelpers.shouldReRunObservabilityTests();
502
+ }
503
+
494
504
  // specs can be passed via command line args as a string
495
505
  // command line args takes precedence over config
496
506
  exports.setUserSpecs = (bsConfig, args) => {
497
- if(o11yHelpers.isBrowserstackInfra() && o11yHelpers.isTestObservabilitySession() && o11yHelpers.shouldReRunObservabilityTests()) {
507
+ if(this.isReRunSpecsSession()) {
498
508
  // BROWSERSTACK_RERUN_TESTS arrives comma+space separated (e.g. "a.ts, b.ts"); normalise
499
509
  // like the other spec sources below, else sanitizeSpecsPattern builds "{a.ts, b.ts}" whose
500
510
  // space-prefixed brace alternatives never match and the failed-spec filter collapses.
@@ -1232,6 +1242,16 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
1232
1242
  files = files.map((x) => { return x.replaceAll("\\", "/") })
1233
1243
  // setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1234
1244
  bsConfig.run_settings.specs = files;
1245
+ } else if (this.isReRunSpecsSession() && files.length) {
1246
+ // BROWSERSTACK_RERUN_TESTS arrives as bare filenames ("a.ts,b.ts"). run_settings is
1247
+ // forwarded to the remote machines verbatim, and a bare filename does not resolve
1248
+ // against the project root there, so Cypress exits having run no spec at all. The
1249
+ // glob above already resolved them against cypressProjectDir — persist those
1250
+ // project-relative paths so the remote receives something it can resolve.
1251
+ bsConfig.run_settings.specs = files
1252
+ .map((file) => path.relative(bsConfig.run_settings.cypressProjectDir, file).replaceAll("\\", "/"))
1253
+ .join(",");
1254
+ logger.debug(`Re-run specs resolved to project-relative paths: ${bsConfig.run_settings.specs}`);
1235
1255
  }
1236
1256
  return files;
1237
1257
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.36.17",
3
+ "version": "1.36.18",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {