Running behat through a PHP CLI script escapes out colour codes

455 views Asked by At

When I run Behat tests directly from Windows PowerShell, the output is formatted with colour:

enter image description here

But when I run the php script runbehat.php below with the command php runbehat.php:

<?php
echo system(__DIR__.'/bin/behat --profile local');

it produces:

enter image description here

How can I make it display in colour?

1

There are 1 answers

0
Youssef Bouhjira On

Add the --colors option.

From the behat's help that you can show using -h:

--colors  Force ANSI color in the output. By default color support is
          guessed based on your platform and the output if not specified.