Recipe 23Get Good Text Output on Windows

Problem

You’re running Cucumber on Windows and want the console output to be green or red based on the pass/fail status of the steps. You also want non-U.S. characters to show up correctly in the output.

Ingredients

  • ANSICON, a Windows helper for ANSI colored output[142]

  • Windows’s built-in chcp command for setting the code page[143]

  • The Consolas[144] or Lucida Console[145] font (both of which ship with recent Windows versions) for correctly displaying Unicode characters

  • Ruby 1.9.x, which handles Unicode better than 1.8.x

Solution

Most command-line environments support cursor movement and text coloring through ANSI escape codes,[146] sequences of special characters that a program can print as part ...

Get Cucumber Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.