Skip to content

Commit b067ef2

Browse files
Karan NagpalKaran Nagpal
authored andcommitted
update method name and other small changes
1 parent 318ec54 commit b067ef2

File tree

8 files changed

+32
-30
lines changed

8 files changed

+32
-30
lines changed

bin/commands/generateDownloads.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ module.exports = async function generateDownloads(args) {
2929
let buildId = args._[1];
3030

3131
await downloadBuildArtifacts(bsConfig, buildId, args);
32-
utils.sendUsageReport(bsConfig, args, 'generate-downloads called', messageType, errorCode);
32+
utils.sendUsageReport(bsConfig, args, Constants.usageReportingConstants.GENERATE_DOWNLOADS, messageType, errorCode);
3333
}).catch(function (err) {
3434
logger.error(err);
3535
utils.setUsageReportingFlag(null, args.disableUsageReporting);
36-
utils.sendUsageReport(null, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
36+
utils.sendUsageReport(bsConfig, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err));
3737
});
3838
};

bin/commands/runs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ module.exports = function run(args) {
6868

6969
// set the no-wrap
7070
utils.setNoWrap(bsConfig, args);
71-
markBlockEnd('setConfig');
7271

7372
// set other cypress configs e.g. reporter and reporter-options
74-
utils.setCypressConfigs(bsConfig, args);
73+
utils.setOtherConfigs(bsConfig, args);
74+
markBlockEnd('setConfig');
7575

7676
// Validate browserstack.json values and parallels specified via arguments
7777
markBlockStart('validateConfig');

bin/helpers/buildArtifacts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ exports.downloadBuildArtifacts = async (bsConfig, buildId, args) => {
209209

210210
utils.sendUsageReport(bsConfig, args, err, messageType, errorCode);
211211
}
212-
};
212+
};

bin/helpers/constants.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ const DEFAULT_CYPRESS_SPEC_PATH = "cypress/integration"
177177
const SPEC_TOTAL_CHAR_LIMIT = 32243;
178178
const METADATA_CHAR_BUFFER_PER_SPEC = 175;
179179

180+
const usageReportingConstants = {
181+
GENERATE_DOWNLOADS: 'generate-downloads called',
182+
}
183+
180184
module.exports = Object.freeze({
181185
syncCLI,
182186
userMessages,
@@ -190,5 +194,6 @@ module.exports = Object.freeze({
190194
specFileTypes,
191195
DEFAULT_CYPRESS_SPEC_PATH,
192196
SPEC_TOTAL_CHAR_LIMIT,
193-
METADATA_CHAR_BUFFER_PER_SPEC
197+
METADATA_CHAR_BUFFER_PER_SPEC,
198+
usageReportingConstants
194199
});

bin/helpers/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ exports.deleteBaseUrlFromError = (err) => {
742742
}
743743

744744
// blindly send other passed configs with run_settings and handle at backend
745-
exports.setCypressConfigs = (bsConfig, args) => {
745+
exports.setOtherConfigs = (bsConfig, args) => {
746746
if (!this.isUndefined(args.reporter)) {
747747
bsConfig["run_settings"]["reporter"] = args.reporter;
748748
}
@@ -762,4 +762,4 @@ exports.getCypressJSON = (bsConfig) => {
762762
return cypressJSON;
763763
}
764764
return undefined;
765-
}
765+
}

bin/runner.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ var argv = yargs
119119
argv = yargs
120120
.usage('usage: $0 run <options>')
121121
.options({
122-
...configFileOptions,
123-
...disableUsageReportingOptions,
124-
...usernameOptions,
125-
...accessKeyOptions,
122+
...commonBuildOptions,
126123
'ccf': {
127124
alias: 'cypress-config-file',
128125
describe: Constants.cliMessages.RUN.CYPRESS_DESC,

test/unit/bin/commands/runs.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe("runs", () => {
104104
setLocalIdentifierStub = sandbox.stub();
105105
setHeadedStub = sandbox.stub();
106106
setNoWrapStub = sandbox.stub();
107-
setCypressConfigsStub = sandbox.stub();
107+
setOtherConfigsStub = sandbox.stub();
108108
deleteResultsStub = sandbox.stub();
109109
setDefaultsStub = sandbox.stub();
110110
setLocalModeStub = sandbox.stub();
@@ -138,7 +138,7 @@ describe("runs", () => {
138138
setLocalIdentifier: setLocalIdentifierStub,
139139
setHeaded: setHeadedStub,
140140
setNoWrap: setNoWrapStub,
141-
setCypressConfigs: setCypressConfigsStub,
141+
setOtherConfigs: setOtherConfigsStub,
142142
deleteResults: deleteResultsStub,
143143
setDefaults: setDefaultsStub,
144144
setupLocalTesting: setupLocalTestingStub,
@@ -178,7 +178,7 @@ describe("runs", () => {
178178
sinon.assert.calledOnce(setLocalConfigFileStub);
179179
sinon.assert.calledOnce(setHeadedStub);
180180
sinon.assert.calledOnce(setNoWrapStub);
181-
sinon.assert.calledOnce(setCypressConfigsStub);
181+
sinon.assert.calledOnce(setOtherConfigsStub);
182182
sinon.assert.calledOnce(capabilityValidatorStub);
183183
sinon.assert.calledOnce(getErrorCodeFromMsgStub);
184184
sinon.assert.calledOnce(setLocalIdentifierStub);
@@ -225,7 +225,7 @@ describe("runs", () => {
225225
setLocalIdentifierStub = sandbox.stub();
226226
setHeadedStub = sandbox.stub();
227227
setNoWrapStub = sandbox.stub();
228-
setCypressConfigsStub = sandbox.stub();
228+
setOtherConfigsStub = sandbox.stub();
229229
deleteResultsStub = sandbox.stub();
230230
getNumberOfSpecFilesStub = sandbox.stub().returns([]);
231231
setDefaultsStub = sandbox.stub();
@@ -262,7 +262,7 @@ describe("runs", () => {
262262
setLocalIdentifier: setLocalIdentifierStub,
263263
setHeaded: setHeadedStub,
264264
setNoWrap: setNoWrapStub,
265-
setCypressConfigs: setCypressConfigsStub,
265+
setOtherConfigs: setOtherConfigsStub,
266266
deleteResults: deleteResultsStub,
267267
setDefaults: setDefaultsStub,
268268
getNumberOfSpecFiles: getNumberOfSpecFilesStub,
@@ -309,7 +309,7 @@ describe("runs", () => {
309309
sinon.assert.calledOnce(setLocalIdentifierStub);
310310
sinon.assert.calledOnce(setHeadedStub);
311311
sinon.assert.calledOnce(setNoWrapStub);
312-
sinon.assert.calledOnce(setCypressConfigsStub);
312+
sinon.assert.calledOnce(setOtherConfigsStub);
313313
sinon.assert.calledOnce(validateBstackJsonStub);
314314
sinon.assert.calledOnce(capabilityValidatorStub);
315315
sinon.assert.calledOnce(archiverStub);
@@ -361,7 +361,7 @@ describe("runs", () => {
361361
setLocalIdentifierStub = sandbox.stub();
362362
setHeadedStub = sandbox.stub();
363363
setNoWrapStub = sandbox.stub();
364-
setCypressConfigsStub = sandbox.stub();
364+
setOtherConfigsStub = sandbox.stub();
365365
deleteResultsStub = sandbox.stub();
366366
getNumberOfSpecFilesStub = sandbox.stub().returns([]);
367367
setDefaultsStub = sandbox.stub();
@@ -399,7 +399,7 @@ describe("runs", () => {
399399
setLocalIdentifier: setLocalIdentifierStub,
400400
setHeaded: setHeadedStub,
401401
setNoWrap: setNoWrapStub,
402-
setCypressConfigs: setCypressConfigsStub,
402+
setOtherConfigs: setOtherConfigsStub,
403403
deleteResults: deleteResultsStub,
404404
getNumberOfSpecFiles: getNumberOfSpecFilesStub,
405405
setDefaults: setDefaultsStub,
@@ -445,7 +445,7 @@ describe("runs", () => {
445445
sinon.assert.calledOnce(setLocalIdentifierStub);
446446
sinon.assert.calledOnce(setHeadedStub);
447447
sinon.assert.calledOnce(setNoWrapStub);
448-
sinon.assert.calledOnce(setCypressConfigsStub);
448+
sinon.assert.calledOnce(setOtherConfigsStub);
449449
sinon.assert.calledOnce(validateBstackJsonStub);
450450
sinon.assert.calledOnce(capabilityValidatorStub);
451451
sinon.assert.calledOnce(archiverStub);
@@ -501,7 +501,7 @@ describe("runs", () => {
501501
setLocalIdentifierStub = sandbox.stub();
502502
setHeadedStub = sandbox.stub();
503503
setNoWrapStub = sandbox.stub();
504-
setCypressConfigsStub = sandbox.stub();
504+
setOtherConfigsStub = sandbox.stub();
505505
deleteResultsStub = sandbox.stub();
506506
getNumberOfSpecFilesStub = sandbox.stub().returns([]);
507507
setDefaultsStub = sandbox.stub();
@@ -540,7 +540,7 @@ describe("runs", () => {
540540
setLocalIdentifier: setLocalIdentifierStub,
541541
setHeaded: setHeadedStub,
542542
setNoWrap: setNoWrapStub,
543-
setCypressConfigs: setCypressConfigsStub,
543+
setOtherConfigs: setOtherConfigsStub,
544544
deleteResults: deleteResultsStub,
545545
getNumberOfSpecFiles: getNumberOfSpecFilesStub,
546546
setDefaults: setDefaultsStub,
@@ -597,7 +597,7 @@ describe("runs", () => {
597597
sinon.assert.calledOnce(setLocalIdentifierStub);
598598
sinon.assert.calledOnce(setHeadedStub);
599599
sinon.assert.calledOnce(setNoWrapStub);
600-
sinon.assert.calledOnce(setCypressConfigsStub);
600+
sinon.assert.calledOnce(setOtherConfigsStub);
601601
sinon.assert.calledOnce(archiverStub);
602602
sinon.assert.calledOnce(setUsageReportingFlagStub);
603603
sinon.assert.calledOnce(zipUploadStub);
@@ -658,7 +658,7 @@ describe("runs", () => {
658658
setLocalIdentifierStub = sandbox.stub();
659659
setHeadedStub = sandbox.stub();
660660
setNoWrapStub = sandbox.stub();
661-
setCypressConfigsStub = sandbox.stub();
661+
setOtherConfigsStub = sandbox.stub();
662662
getNumberOfSpecFilesStub = sandbox.stub().returns([]);
663663
setLocalConfigFileStub = sandbox.stub();
664664
getTimeComponentsStub = sandbox.stub().returns({});
@@ -700,7 +700,7 @@ describe("runs", () => {
700700
setLocalIdentifier: setLocalIdentifierStub,
701701
setHeaded: setHeadedStub,
702702
setNoWrap: setNoWrapStub,
703-
setCypressConfigs: setCypressConfigsStub,
703+
setOtherConfigs: setOtherConfigsStub,
704704
exportResults: exportResultsStub,
705705
deleteResults: deleteResultsStub,
706706
setDefaults: setDefaultsStub,
@@ -766,7 +766,7 @@ describe("runs", () => {
766766
sinon.assert.calledOnce(setLocalIdentifierStub);
767767
sinon.assert.calledOnce(setHeadedStub);
768768
sinon.assert.calledOnce(setNoWrapStub);
769-
sinon.assert.calledOnce(setCypressConfigsStub);
769+
sinon.assert.calledOnce(setOtherConfigsStub);
770770
sinon.assert.calledOnce(archiverStub);
771771
sinon.assert.calledOnce(setUsageReportingFlagStub);
772772
sinon.assert.calledOnce(zipUploadStub);

test/unit/bin/helpers/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ describe('utils', () => {
20242024
});
20252025
});
20262026

2027-
describe('setCypressConfigs', () => {
2027+
describe('setOtherConfigs', () => {
20282028
it('set reporter arg in run_settings', () => {
20292029
let bsConfig = {
20302030
run_settings: {
@@ -2034,7 +2034,7 @@ describe('utils', () => {
20342034
reporter: "mocha",
20352035
'reporter-options': "random-string"
20362036
};
2037-
utils.setCypressConfigs(bsConfig, args);
2037+
utils.setOtherConfigs(bsConfig, args);
20382038
expect(bsConfig.run_settings.reporter).to.be.eql("mocha");
20392039
});
20402040

@@ -2046,7 +2046,7 @@ describe('utils', () => {
20462046
let args = {
20472047
'reporterOptions': "random-string"
20482048
};
2049-
utils.setCypressConfigs(bsConfig, args);
2049+
utils.setOtherConfigs(bsConfig, args);
20502050
expect(bsConfig.run_settings.reporter_options).to.be.eql("random-string");
20512051
});
20522052
});

0 commit comments

Comments
 (0)