Skip to content

Commit 2dd0748

Browse files
committed
Starting off the syn cli changes
1 parent 81c3235 commit 2dd0748

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

bin/commands/runs.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const archiver = require("../helpers/archiver"),
77
capabilityHelper = require("../helpers/capabilityHelper"),
88
Constants = require("../helpers/constants"),
99
utils = require("../helpers/utils"),
10-
fileHelpers = require("../helpers/fileHelpers");
10+
fileHelpers = require("../helpers/fileHelpers"),
11+
syncRunner = require("../helpers/syncRunner");
1112

1213
module.exports = function run(args) {
1314
let bsConfigPath = utils.getConfigPath(args.cf);
@@ -65,6 +66,14 @@ module.exports = function run(args) {
6566

6667
if (!args.disableNpmWarning && bsConfig.run_settings.npm_dependencies && Object.keys(bsConfig.run_settings.npm_dependencies).length <= 0) logger.warn(Constants.userMessages.NO_NPM_DEPENDENCIES);
6768

69+
if (args.sync) {
70+
syncRunner.pollBuildStatus(bsConfig, data.build_id).then((exitCode) => {
71+
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);
72+
73+
process.exit(exitCode);
74+
});
75+
}
76+
6877
logger.info(message);
6978
logger.info(dashboardLink);
7079
utils.sendUsageReport(bsConfig, args, `${message}\n${dashboardLink}`, Constants.messageTypes.SUCCESS, null);

bin/helpers/constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const userMessages = {
33
BUILD_CREATED: "Build created",
44
BUILD_INFO_FAILED: "Failed to get build info.",
55
BUILD_STOP_FAILED: "Failed to stop build.",
6+
BUILD_REPORT_MESDSAGE: "See the entire build report here:",
67
ZIP_UPLOADER_NOT_REACHABLE: "Could not reach to zip uploader.",
78
ZIP_UPLOAD_FAILED: "Zip Upload failed.",
89
CONFIG_FILE_CREATED: "BrowserStack Config File created, you can now run browserstack-cypress --config-file run",
@@ -68,7 +69,8 @@ const cliMessages = {
6869
EXCLUDE: "Exclude files matching a pattern from zipping and uploading",
6970
DEFAULT_PARALLEL_MESSAGE: "Here goes the number of parallels you want to run",
7071
SPECS_DESCRIPTION: 'Specify the spec files to run',
71-
ENV_DESCRIPTION: "Specify the environment variables for your spec files"
72+
ENV_DESCRIPTION: "Specify the environment variables for your spec files",
73+
SYNC_DESCRIPTION: "Makes the run command in sync"
7274
},
7375
COMMON: {
7476
DISABLE_USAGE_REPORTING: "Disable usage reporting",

bin/runner.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ var argv = yargs
195195
default: false,
196196
description: Constants.cliMessages.COMMON.NO_NPM_WARNING,
197197
type: "boolean"
198+
},
199+
'sync': {
200+
default: false,
201+
describe: Constants.cliMessages.SYNC_DESCRIPTION,
202+
type: "boolean"
198203
}
199204
})
200205
.help('help')

0 commit comments

Comments
 (0)