From e5b872a05bcd5493431c234d826d2b131d1077a9 Mon Sep 17 00:00:00 2001 From: KobeNguyenT <7845001+kobenguyent@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:10:38 +0100 Subject: [PATCH] fix: arg printed as object object (#23) --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 9ba0e06..2a016ac 100644 --- a/index.js +++ b/index.js @@ -198,8 +198,9 @@ module.exports = (config) => { for (test of testTempIdArr) { for (step of test.testSteps) { // typo would be fixed by https://github.com/codeceptjs/CodeceptJS/pull/4077 - const stepArgs = step.agrs ? step.agrs : step.args - const stepTitle = stepArgs ? `[STEP] - ${step.actor} ${step.name} ${JSON.stringify(stepArgs.map(item => item && item._secret ? '*****' : item).join(' '))}` : `[STEP] - ${step.actor} ${step.name}`; + const stepArgs = step.agrs ? step.agrs : step.args; + // if arg is typeof Secret, mask its value, if arg is an object, stringify it, otherwise leave it as it is + const stepTitle = stepArgs ? `[STEP] - ${step.actor} ${step.name} ${JSON.stringify(stepArgs.map(item => item && item._secret ? '*****' : (typeof item === 'object') ? JSON.stringify(item) : item).join(' '))}` : `[STEP] - ${step.actor} ${step.name}`; const stepObj = await startTestItem(launchObj.tempId, stepTitle, rp_STEP, test.testTempId); stepObj.status = step.status || rp_PASSED;