Skip to content

Commit 1dff778

Browse files
Merge pull request #967 from browserstack/HST_1963_cypress_folder
add: handling for different folder structure turboscale
2 parents 04331b9 + 399622f commit 1dff778

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

bin/helpers/utils.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,10 +1179,17 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressConfig, turboScaleSession
11791179
logger.debug(`${files ? files.length : 0} spec files found`);
11801180

11811181
if (turboScaleSession) {
1182-
// remove unwanted path prefix for turboscale
1183-
files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) })
1184-
// setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1185-
bsConfig.run_settings.specs = files;
1182+
if (bsConfig.run_settings.cypress_config_file && bsConfig.run_settings.cypress_config_filename !== 'false') {
1183+
const configFilePath = path.resolve(bsConfig.run_settings.cypressConfigFilePath);
1184+
const directory = path.join(path.dirname(configFilePath), '/');
1185+
// remove unwanted path prefix for turboscale
1186+
files = files.map((x) => { return path.join('', x.split(directory)[1]) })
1187+
// setting specs for turboScale as we don't have patched API for turboscale so we will rely on info from CLI
1188+
bsConfig.run_settings.specs = files;
1189+
} else {
1190+
files = files.map((x) => { return path.join(testFolderPath, x.split(testFolderPath)[1]) })
1191+
bsConfig.run_settings.specs = files;
1192+
}
11861193
}
11871194
return files;
11881195
};

0 commit comments

Comments
 (0)