Skip to content

Commit 212acfc

Browse files
committed
move metadata constant to constant file
1 parent efdd866 commit 212acfc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

bin/helpers/constants.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ const specFileTypes = ['js', 'ts', 'feature', 'jsx', 'coffee', 'cjsx'];
135135

136136
const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration"
137137

138-
const SPEC_TOTAL_CHAR_LIMIT = 32243
138+
const SPEC_TOTAL_CHAR_LIMIT = 32243;
139+
const METADATA_CHAR_BUFFER_PER_SPEC = 175;
139140

140141
module.exports = Object.freeze({
141142
syncCLI,
@@ -147,5 +148,6 @@ module.exports = Object.freeze({
147148
filesToIgnoreWhileUploading,
148149
specFileTypes,
149150
DEFAULT_CYPRESS_SPEC_PATH,
150-
SPEC_TOTAL_CHAR_LIMIT
151+
SPEC_TOTAL_CHAR_LIMIT,
152+
METADATA_CHAR_BUFFER_PER_SPEC
151153
});

bin/helpers/utils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ exports.setParallels = (bsConfig, args, numOfSpecs) => {
149149
};
150150

151151
exports.warnSpecLimit = (bsConfig, args, specFiles) => {
152-
let expectedCharLength = specFiles.join("").length + 175 * specFiles.length;
153-
let parallels = bsConfig['run_settings']['parallels'];
152+
let expectedCharLength = specFiles.join("").length + Constants.METADATA_CHAR_BUFFER_PER_SPEC * specFiles.length;
153+
let parallels = bsConfig.run_settings.parallels;
154154
let combinations = this.getBrowserCombinations(bsConfig).length;
155-
let parallelPerCombination = parallels > combinations ? Math.floor(parallels / combinations) : 1
156-
let expectedCharLengthPerParallel = expectedCharLength / parallelPerCombination
155+
let parallelPerCombination = parallels > combinations ? Math.floor(parallels / combinations) : 1;
156+
let expectedCharLengthPerParallel = Math.floor(expectedCharLength / parallelPerCombination);
157157
if (expectedCharLengthPerParallel > Constants.SPEC_TOTAL_CHAR_LIMIT) {
158158
logger.warn(Constants.userMessages.SPEC_LIMIT_WARNING);
159159
this.sendUsageReport(

0 commit comments

Comments
 (0)