diff --git a/lib/index.js b/lib/index.js index 9f6703dba..2302b0330 100644 --- a/lib/index.js +++ b/lib/index.js @@ -38,6 +38,8 @@ module.exports = { store: require('./store'), /** @type {typeof CodeceptJS.Locator} */ locator: require('./locator'), + /** @type {typeof CodeceptJS.Step} */ + Step: require('./step'), heal: require('./heal'), ai: require('./ai'), diff --git a/lib/output.js b/lib/output.js index fc209d043..7b1cb8fcd 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1,6 +1,7 @@ const colors = require('chalk') const figures = require('figures') const { maskSensitiveData } = require('invisi-data') +const Step = require('./step') const styles = { error: colors.bgRed.white.bold, @@ -115,17 +116,24 @@ module.exports = { } } - let stepLine = step.toCliStyled() - if (step.metaStep && outputLevel >= 1) { - // this.stepShift += 2; - stepLine = colors.dim(truncate(stepLine, this.spaceShift)) - } - if (step.comment) { - stepLine += colors.grey(step.comment.split('\n').join('\n' + ' '.repeat(4))) - } + if (step instanceof Step) { + let stepLine = step.toCliStyled() + if (step.metaStep && outputLevel >= 1) { + // this.stepShift += 2; + stepLine = colors.dim(truncate(stepLine, this.spaceShift)) + } + if (step.comment) { + stepLine += colors.grey(step.comment.split('\n').join('\n' + ' '.repeat(4))) + } - const _stepLine = isMaskedData() ? maskSensitiveData(stepLine) : stepLine - print(' '.repeat(this.stepShift), truncate(_stepLine, this.spaceShift)) + const _stepLine = isMaskedData() ? maskSensitiveData(stepLine) : stepLine + print(' '.repeat(this.stepShift), truncate(_stepLine, this.spaceShift)) + } else if (typeof step === 'string') { + // sometimes the step is just the string, so we basically print it out + print(step) + } else { + console.log(`Something went wrong with ${step}`) + } }, /** @namespace */