MCPcopy
hub / github.com/stepci/stepci / colorIfNonZero

Function colorIfNonZero

src/lib/render.ts:185–187  ·  view source on GitHub ↗
(n: number, color: Chalk, text: string)

Source from the content-addressed store, hash-verified

183 const failedSteps = steps.filter(step => !step.passed).length
184
185 function colorIfNonZero(n: number, color: Chalk, text: string): string {
186 return n > 0 ? color.bold(text) : chalk.bold(text)
187 }
188
189 console.log(`\n${chalk.bold('Tests:')} ${colorIfNonZero(failedTests, chalk.redBright, failedTests + ' failed')}, ${colorIfNonZero(passedTests, chalk.greenBright, passedTests + ' passed')}, ${result.tests.length} total`)
190 console.log(`${chalk.bold('Steps:')} ${colorIfNonZero(failedSteps, chalk.redBright, failedSteps + ' failed')}, ${colorIfNonZero(skippedSteps, chalk.yellowBright, skippedSteps + ' skipped')}, ${colorIfNonZero(passedSteps, chalk.greenBright, passedSteps + ' passed')}, ${steps.length} total`)

Callers 1

renderSummaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected