-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle spec level timeouts #248
Changes from all commits
b218868
a3da2ff
c9317b5
abce52e
96e21b6
718a432
daadf86
14abaa9
2c4d3d4
7b43f7a
7298902
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -310,6 +310,23 @@ exports.setGeolocation = (bsConfig, args) => { | |
} | ||
} | ||
|
||
exports.isSpecTimeoutArgPassed = () => { | ||
return this.searchForOption('--spec-timeout') || this.searchForOption('-t'); | ||
} | ||
exports.setSpecTimeout = (bsConfig, args) => { | ||
let specTimeout = null; | ||
if(this.isSpecTimeoutArgPassed()) { | ||
if(!this.isUndefined(args.specTimeout)) { | ||
specTimeout = args.specTimeout; | ||
} else { | ||
specTimeout = 'undefined' | ||
} | ||
} else if (!this.isUndefined(bsConfig.run_settings.spec_timeout)) { | ||
specTimeout = bsConfig.run_settings.spec_timeout; | ||
} | ||
bsConfig.run_settings.spec_timeout = specTimeout; | ||
} | ||
|
||
// specs can be passed from bstack configuration file | ||
// specs can be passed via command line args as a string | ||
// command line args takes precedence over config | ||
|
@@ -390,10 +407,26 @@ exports.fixCommaSeparatedString = (string) => { | |
|
||
exports.isUndefined = value => (value === undefined || value === null); | ||
|
||
exports.isPositiveInteger = (str) => { | ||
if (typeof str !== 'string') { | ||
return false; | ||
} | ||
|
||
const num = Number(str); | ||
|
||
if (this.isInteger(num) && num > 0) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
exports.isTrueString = value => (!this.isUndefined(value) && value.toString().toLowerCase() === 'true'); | ||
|
||
exports.isFloat = (value) => Number(value) && Number(value) % 1 !== 0; | ||
|
||
exports.isInteger = (value) => Number.isInteger(value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add tests for these too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
exports.nonEmptyArray = (value) => { | ||
if(!this.isUndefined(value) && value && value.length) { | ||
return true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,6 +168,12 @@ var argv = yargs | |
type: "string", | ||
default: undefined | ||
}, | ||
't': { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add help section for this arg. Also specify There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. by help section do you mean the description have added it under |
||
alias: ['specTimeout'], | ||
default: undefined, | ||
describe: Constants.cliMessages.RUN.SPEC_TIMEOUT, | ||
type: "string" | ||
}, | ||
'disable-npm-warning': { | ||
default: false, | ||
description: Constants.cliMessages.COMMON.NO_NPM_WARNING, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add tests for these too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done