Skip to content

Commit 332f6d5

Browse files
authored
Merge pull request #402 from roshan04/support_multiple_cyp10_files
Support multiple cyp10 files
2 parents e8c2552 + 46ed99a commit 332f6d5

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

bin/helpers/archiver.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ const archiveSpecs = (runSettings, filePath, excludeFiles, md5data) => {
8383
) {
8484
if (runSettings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {
8585
let cypressConfigFileString = fs.readFileSync(runSettings.cypressConfigFilePath, {encoding: "utf-8"});
86-
archive.append(cypressConfigFileString, {name: `${cypressAppendFilesZipLocation}${runSettings.cypress_config_filename}`});
86+
for (const possibleCypressFileName of Constants.CYPRESS_CONFIG_FILE_NAMES) {
87+
if (path.extname(runSettings.cypress_config_filename) == path.extname(possibleCypressFileName)) {
88+
archive.append(cypressConfigFileString, {name: `${cypressAppendFilesZipLocation}${possibleCypressFileName}`});
89+
break;
90+
}
91+
}
8792
} else if (runSettings.cypressTestSuiteType === Constants.CYPRESS_V9_AND_OLDER_TYPE) {
8893
let cypressJSON = JSON.parse(fs.readFileSync(runSettings.cypressConfigFilePath));
8994
let cypressJSONString = JSON.stringify(cypressJSON, null, 4);

bin/helpers/capabilityHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ const validate = (bsConfig, args) => {
250250
let listOfFiles = fs.readdirSync(cypressFileDirectory);
251251
let configFilesPresent = [];
252252
for (const possibleCypressFileName of Constants.CYPRESS_CONFIG_FILE_NAMES) {
253-
if (listOfFiles.includes(possibleCypressFileName)) {
253+
if (listOfFiles.includes(possibleCypressFileName) || path.extname(possibleCypressFileName) == path.extname(bsConfig.run_settings.cypress_config_filename)) {
254254
configFilesPresent.push(possibleCypressFileName);
255255
}
256256
}

bin/helpers/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ exports.setCypressConfigFilename = (bsConfig, args) => {
308308
}
309309

310310
logger.debug(`Setting cypress config file path = ${bsConfig.run_settings.cypressConfigFilePath}`);
311-
logger.debug(`Setting cypress project dir = ${bsConfig.run_settings.cypressProjDir}`);
311+
logger.debug(`Setting cypress project dir = ${bsConfig.run_settings.cypressProjectDir}`);
312312
}
313313

314314
exports.setCypressTestSuiteType = (bsConfig) => {
315315
for (const possibleCypressFileName of Constants.CYPRESS_CONFIG_FILE_NAMES) {
316316
if (bsConfig.run_settings.cypressConfigFilePath &&
317317
typeof(bsConfig.run_settings.cypressConfigFilePath) === 'string' &&
318-
bsConfig.run_settings.cypressConfigFilePath.endsWith(possibleCypressFileName)) {
318+
(path.extname(bsConfig.run_settings.cypressConfigFilePath) == path.extname(possibleCypressFileName) || bsConfig.run_settings.cypressConfigFilePath.endsWith(possibleCypressFileName))) {
319319
bsConfig.run_settings.cypressTestSuiteType = Constants.CYPRESS_CONFIG_FILE_MAPPING[possibleCypressFileName].type;
320320
break;
321321
}

bin/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ var argv = yargs
136136
'ccf': {
137137
alias: 'cypress-config-file',
138138
describe: Constants.cliMessages.RUN.CYPRESS_DESC,
139-
default: './cypress.config.js',
139+
default: './cypress.json',
140140
type: 'string',
141141
nargs: 1,
142142
demand: true,

test/unit/bin/helpers/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,9 +1881,7 @@ describe('utils', () => {
18811881

18821882
it('by default assumes that CYPRESS_V9_AND_OLDER_TYPE is the test suite type', () => {
18831883
bsConfig = {
1884-
run_settings: {
1885-
cypressConfigFilePath: 'anyOtherFile.js',
1886-
},
1884+
run_settings: {},
18871885
};
18881886
utils.setCypressTestSuiteType(bsConfig);
18891887
expect(bsConfig.run_settings.cypressTestSuiteType).to.be.eq(Contants.CYPRESS_V9_AND_OLDER_TYPE);

0 commit comments

Comments
 (0)