diff --git a/lib/command/interactive.js b/lib/command/interactive.js index 44398798a..4cacb7a70 100644 --- a/lib/command/interactive.js +++ b/lib/command/interactive.js @@ -23,15 +23,23 @@ module.exports = async function (path, options) { if (options.verbose) output.level(3) + let addGlobalRetries + + if (config.retry) { + addGlobalRetries = function retries() {} + } + output.print('Starting interactive shell for current suite...') recorder.start() event.emit(event.suite.before, { fullTitle: () => 'Interactive Shell', tests: [], + retries: addGlobalRetries, }) event.emit(event.test.before, { title: '', artifacts: {}, + retries: addGlobalRetries, }) const enabledHelpers = Container.helpers() diff --git a/lib/utils.js b/lib/utils.js index f27c36e3e..9dc2680e7 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -94,19 +94,19 @@ module.exports.template = function (template, data) { /** * Make first char uppercase. * @param {string} str - * @returns {string} + * @returns {string | undefined} */ module.exports.ucfirst = function (str) { - return str.charAt(0).toUpperCase() + str.substr(1) + if (str) return str.charAt(0).toUpperCase() + str.substr(1) } /** * Make first char lowercase. * @param {string} str - * @returns {string} + * @returns {string | undefined} */ module.exports.lcfirst = function (str) { - return str.charAt(0).toLowerCase() + str.substr(1) + if (str) return str.charAt(0).toLowerCase() + str.substr(1) } module.exports.chunkArray = function (arr, chunk) { diff --git a/test/unit/utils_test.js b/test/unit/utils_test.js index b4b66a8a2..2367c2f4b 100644 --- a/test/unit/utils_test.js +++ b/test/unit/utils_test.js @@ -38,6 +38,10 @@ describe('utils', () => { it('should capitalize first letter', () => { expect(utils.ucfirst('hello')).equal('Hello') }) + + it('should handle the undefined', () => { + expect(utils.ucfirst()).to.be.undefined + }) }) describe('#beautify', () => {