Skip to content

Commit ace87ce

Browse files
committed
Merge branch 'master' into AFD-960-release-cypress-10-3-0
2 parents d8b4644 + b3d3fef commit ace87ce

File tree

6 files changed

+328
-120
lines changed

6 files changed

+328
-120
lines changed

bin/commands/runs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ module.exports = function run(args, rawArgs) {
100100
// set record feature caps
101101
utils.setRecordCaps(bsConfig, args);
102102

103+
// set build tag caps
104+
utils.setBuildTags(bsConfig, args);
103105
// set node version
104106
utils.setNodeVersion(bsConfig, args);
105107

bin/helpers/constants.js

Lines changed: 239 additions & 117 deletions
Large diffs are not rendered by default.

bin/helpers/utils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,20 @@ exports.setTestEnvs = (bsConfig, args) => {
479479
logger.debug(`Setting env vars = ${bsConfig.run_settings.env}`);
480480
}
481481

482+
exports.setBuildTags = (bsConfig, args) => {
483+
let buildTag = undefined;
484+
if(!this.isUndefined(args["build-tag"])) {
485+
buildTag = args["build-tag"];
486+
} else {
487+
buildTag = bsConfig.run_settings.build_tag;
488+
}
489+
if(!this.isUndefined(buildTag)) {
490+
buildTag = buildTag.toString();
491+
}
492+
bsConfig.run_settings.build_tag = buildTag;
493+
logger.debug(`Setting the build tag = ${bsConfig.run_settings.build_tag}`);
494+
};
495+
482496
exports.setSystemEnvs = (bsConfig) => {
483497
let envKeys = {};
484498

bin/runner.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ var argv = yargs
271271
default: undefined,
272272
describe: Constants.cliMessages.RUN.NODE_VERSION,
273273
type: "string"
274+
},
275+
'build-tag': {
276+
default: undefined,
277+
describe: Constants.cliMessages.RUN.BUILD_TAG,
278+
type: "string"
274279
}
275280
})
276281
.help('help')

test/unit/bin/commands/runs.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ describe("runs", () => {
122122
setSpecTimeoutStub = sandbox.stub().returns(undefined);
123123
setRecordCapsStub = sandbox.stub().returns(undefined);
124124
setNodeVersionStub = sandbox.stub();
125+
setBuildTagsStub = sandbox.stub();
125126
});
126127

127128
afterEach(() => {
@@ -166,7 +167,8 @@ describe("runs", () => {
166167
setSpecTimeout: setSpecTimeoutStub,
167168
setRecordCaps: setRecordCapsStub,
168169
setDebugMode: setDebugModeStub,
169-
setNodeVersion: setNodeVersionStub
170+
setNodeVersion: setNodeVersionStub,
171+
setBuildTags: setBuildTagsStub
170172
},
171173
'../helpers/capabilityHelper': {
172174
validate: capabilityValidatorStub
@@ -215,6 +217,7 @@ describe("runs", () => {
215217
sinon.assert.calledOnce(getInitialDetailsStub);
216218
sinon.assert.calledOnce(setRecordCapsStub);
217219
sinon.assert.calledOnce(setNodeVersionStub);
220+
sinon.assert.calledOnce(setBuildTagsStub);
218221
sinon.assert.calledOnceWithExactly(
219222
sendUsageReportStub,
220223
bsConfig,
@@ -276,6 +279,7 @@ describe("runs", () => {
276279
setSpecTimeoutStub = sandbox.stub().returns(undefined);
277280
setRecordCapsStub = sandbox.stub().returns(undefined);
278281
setNodeVersionStub = sandbox.stub();
282+
setBuildTagsStub = sandbox.stub();
279283
});
280284

281285
afterEach(() => {
@@ -323,7 +327,8 @@ describe("runs", () => {
323327
setSpecTimeout: setSpecTimeoutStub,
324328
setRecordCaps: setRecordCapsStub,
325329
setDebugMode: setDebugModeStub,
326-
setNodeVersion: setNodeVersionStub
330+
setNodeVersion: setNodeVersionStub,
331+
setBuildTags: setBuildTagsStub
327332
},
328333
'../helpers/capabilityHelper': {
329334
validate: capabilityValidatorStub,
@@ -391,6 +396,7 @@ describe("runs", () => {
391396
sinon.assert.calledOnce(getInitialDetailsStub);
392397
sinon.assert.calledOnce(setRecordCapsStub);
393398
sinon.assert.calledOnce(setNodeVersionStub);
399+
sinon.assert.calledOnce(setBuildTagsStub);
394400
sinon.assert.calledOnceWithExactly(
395401
sendUsageReportStub,
396402
bsConfig,
@@ -454,6 +460,7 @@ describe("runs", () => {
454460
getInitialDetailsStub = sandbox.stub();
455461
setRecordCapsStub = sandbox.stub().returns(undefined);
456462
setNodeVersionStub = sandbox.stub();
463+
setBuildTagsStub = sandbox.stub();
457464
});
458465

459466
afterEach(() => {
@@ -502,7 +509,8 @@ describe("runs", () => {
502509
setSpecTimeout: setSpecTimeoutStub,
503510
setRecordCaps: setRecordCapsStub,
504511
setDebugMode: setDebugModeStub,
505-
setNodeVersion: setNodeVersionStub
512+
setNodeVersion: setNodeVersionStub,
513+
setBuildTags: setBuildTagsStub
506514
},
507515
'../helpers/capabilityHelper': {
508516
validate: capabilityValidatorStub,
@@ -572,6 +580,7 @@ describe("runs", () => {
572580
sinon.assert.calledOnce(getInitialDetailsStub);
573581
sinon.assert.calledOnce(setRecordCapsStub);
574582
sinon.assert.calledOnce(setNodeVersionStub);
583+
sinon.assert.calledOnce(setBuildTagsStub);
575584
sinon.assert.calledOnceWithExactly(
576585
sendUsageReportStub,
577586
bsConfig,
@@ -640,6 +649,7 @@ describe("runs", () => {
640649
getInitialDetailsStub = sandbox.stub();
641650
setRecordCapsStub = sandbox.stub().returns(undefined);
642651
setNodeVersionStub = sandbox.stub();
652+
setBuildTagsStub = sandbox.stub();
643653
});
644654

645655
afterEach(() => {
@@ -690,6 +700,7 @@ describe("runs", () => {
690700
setRecordCaps: setRecordCapsStub,
691701
setDebugMode: setDebugModeStub,
692702
setNodeVersion: setNodeVersionStub,
703+
setBuildTags: setBuildTagsStub
693704
},
694705
'../helpers/capabilityHelper': {
695706
validate: capabilityValidatorStub,
@@ -770,6 +781,7 @@ describe("runs", () => {
770781
sinon.assert.calledOnce(getInitialDetailsStub);
771782
sinon.assert.calledOnce(setRecordCapsStub);
772783
sinon.assert.calledOnce(setNodeVersionStub);
784+
sinon.assert.calledOnce(setBuildTagsStub);
773785

774786
sinon.assert.calledOnceWithExactly(
775787
sendUsageReportStub,
@@ -852,6 +864,7 @@ describe("runs", () => {
852864
getInitialDetailsStub = sandbox.stub();
853865
setRecordCapsStub = sandbox.stub().returns(undefined);
854866
setNodeVersionStub = sandbox.stub();
867+
setBuildTagsStub = sandbox.stub();
855868
});
856869

857870
afterEach(() => {
@@ -910,6 +923,7 @@ describe("runs", () => {
910923
setRecordCaps: setRecordCapsStub,
911924
setDebugMode: setDebugModeStub,
912925
setNodeVersion: setNodeVersionStub,
926+
setBuildTags: setBuildTagsStub
913927
},
914928
'../helpers/capabilityHelper': {
915929
validate: capabilityValidatorStub,
@@ -1006,6 +1020,7 @@ describe("runs", () => {
10061020
sinon.assert.calledOnce(getInitialDetailsStub);
10071021
sinon.assert.calledOnce(setRecordCapsStub);
10081022
sinon.assert.calledOnce(setNodeVersionStub);
1023+
sinon.assert.calledOnce(setBuildTagsStub);
10091024
sinon.assert.match(
10101025
sendUsageReportStub.getCall(0).args,
10111026
[

test/unit/bin/helpers/utils.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,6 +3379,56 @@ describe('utils', () => {
33793379
});
33803380
});
33813381

3382+
describe('setBuildTags', () => {
3383+
it('should give preference to args', () => {
3384+
let bsConfig = {
3385+
run_settings: {
3386+
build_tag: "abc"
3387+
}
3388+
}
3389+
3390+
let args = {
3391+
"build-tag": "def"
3392+
}
3393+
utils.setBuildTags(bsConfig, args);
3394+
expect(bsConfig.run_settings.build_tag).to.be.eq("def");
3395+
});
3396+
3397+
it('should honour bstack json if args not passed', () => {
3398+
let bsConfig = {
3399+
run_settings: {
3400+
build_tag: "abc"
3401+
}
3402+
}
3403+
3404+
let args = {}
3405+
utils.setBuildTags(bsConfig, args);
3406+
expect(bsConfig.run_settings.build_tag).to.be.eq("abc");
3407+
});
3408+
3409+
it('should convert values to string', () => {
3410+
let bsConfig = {
3411+
run_settings: {
3412+
build_tag: 1234
3413+
}
3414+
}
3415+
3416+
let args = {}
3417+
utils.setBuildTags(bsConfig, args);
3418+
expect(bsConfig.run_settings.build_tag).to.be.eq("1234");
3419+
});
3420+
3421+
it('should set undefined if args and bstack json caps not passed', () => {
3422+
let bsConfig = {
3423+
run_settings: {}
3424+
}
3425+
3426+
let args = {}
3427+
utils.setBuildTags(bsConfig, args);
3428+
expect(bsConfig.run_settings.build_tag).to.be.eq(undefined);
3429+
});
3430+
});
3431+
33823432
describe('getMajorVersion', () => {
33833433
it('should return null if undefined version is sent', () => {
33843434
expect(utils.getMajorVersion()).to.be.eql(null);

0 commit comments

Comments
 (0)