or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-4/

Terminal Status Banner

Build a simple status banner generator for terminal applications that displays status messages with colored backgrounds.

Requirements

Create a module that exports a single function createStatusBanner(status, message) that generates formatted terminal output with appropriate background colors based on the status type.

The function should:

  • Accept a status string parameter (one of: "error", "success", "warning", "info")
  • Accept a message string parameter containing the text to display
  • Return a string with the message formatted with an appropriate background color
  • Use red background for "error" status
  • Use green background for "success" status
  • Use yellow background for "warning" status
  • Use cyan background for "info" status
  • Return the message unchanged (no background) for any other status value

Test Cases

  • Calling createStatusBanner("error", "Failed to connect") returns the message with a red background @test
  • Calling createStatusBanner("success", "Operation completed") returns the message with a green background @test
  • Calling createStatusBanner("warning", "Low disk space") returns the message with a yellow background @test
  • Calling createStatusBanner("info", "Loading data") returns the message with a cyan background @test
  • Calling createStatusBanner("unknown", "Some message") returns the message without any background color @test

@generates

API

/**
 * Creates a status banner with colored background based on status type
 *
 * @param {string} status - The status type: "error", "success", "warning", or "info"
 * @param {string} message - The message to display
 * @returns {string} The formatted message with appropriate background color
 */
function createStatusBanner(status, message) {
  // IMPLEMENTATION HERE
}

module.exports = { createStatusBanner };

Dependencies { .dependencies }

picocolors { .dependency }

Provides terminal color formatting support with background color functions.

@satisfied-by