From 5cad89be65b7f37df39957339dc18b342e4172f9 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Mon, 10 Feb 2025 13:00:10 +0100 Subject: [PATCH 1/2] fix: undefined string when using ucfirst --- lib/utils.js | 8 ++++---- test/unit/utils_test.js | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) 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', () => { From 51e726ed48b6e81afe38c004e3acdedc20738240 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Mon, 10 Feb 2025 16:18:15 +0100 Subject: [PATCH 2/2] fix: retries is not a function in shell command --- lib/command/interactive.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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()