gerardroche / sublime-phpunit

PHPUnit Sublime Text integration.
https://www.gerardroche.com
GNU General Public License v3.0
74 stars 11 forks source link

Still can't disable colors via "colors=never": true #82

Closed myself379 closed 6 years ago

myself379 commented 6 years ago

Hi, I'm still getting ANSI color even though I disable the color in phpunit.xml and via phpunit.option while searching for a solution in this github issue.

I'm using Material Theme, on Windows 10.

How can I apply ANSIEscape on the output console? What is the output console called? Build Console? Terminal?

cannot disable color

PHPUnit output console phpunit

The phpunit.xml in my root project phpunit xml

The option in sublime text 3 settings phpunit option

myself379 commented 6 years ago

After testing with the PHPunit itself within the vendor file. I realized that the Command-Line Options in documents PHPunit 5.7 doesn't match with the actual.

In the Docs it says

--colors=<flag>             Use colors in output ("never", "auto" or "always").

but when I ran

./vendor/bin/phpunit --colors=never

or

 ./vendor/phpunit/phpunit/phpunit --colors=never

It just doesn't work. but this works

./vendor/bin/phpunit --color=never

So I just adjusted to color with no s

Anyhow, I still wish to color it with ANSIescape, how can I pass in the ANSIescape into the build when tigger PHPUnitkit? Please enlighten me.

gerardroche commented 6 years ago

It's not possible pass in the ANSIescape into the build. The PHPUnitKit results output looks ok. It looks like it's the output of dd() that is causing the issue.

myself379 commented 6 years ago

Hi @gerardroche, thanks for looking into this issue.

Someone have include that ANSIescape into their build. How can I pass this into the plugins? I'm totally noob in Sublime Text plugins, how is your plugins triggered the cmd?

Reference: Ansi color codes in build output Create a new build system definition in Sublime Text and configure it to recognize ANSI colors

excerpt

// Recognize ANSI colors in the output
"target": "ansi_color_build",
"syntax": "Packages/ANSIescape/ANSI.tmLanguage"

Actually its the PHPUnit 5.7 issue. I'm not sure why the docs wrote --colors but it is --color (yes, without the s) instead.

This is the side-by-side comparison,

colors=never

colors never

color=never

color never

gerardroche commented 6 years ago

PHPUnit doesn't have a --color option. It has a --colors option.

The reason disabling the --color option works is because that disables color for the dd() function.

See:

https://github.com/laravel/framework/blob/5.5/src/Illuminate/Support/Debug/Dumper.php

and

https://github.com/symfony/var-dumper/blob/6496e9295dbbeed237461236edd2db0643033f5e/Dumper/CliDumper.php#L467

Your only option is to disable the color output for dd(). Just set "color=never": true or "color": false.

myself379 commented 6 years ago

@gerardroche Ah, that's the missing link in my head! It makes sense to me now! No wonder it keeps ignoring my --colors option.

Thanks @gerardroche

But I really wish I could able to integrate your work with ANSIescape and apply it in build. This PHPUnitkit is using the "build" provided by Sublime Text (3), right?

gerardroche commented 6 years ago

Normally your phpunit results output shouldnb't have debug output. There is no reasonable way to colorize output other than what's expected to be output by PHPUnit.

Sublime Text uses syntaxes and color schemes to color the output, so ANSIescapes don't have anything to do with it.