gerardroche / sublime-phpunit

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

Add support for Laravel's artisan test command #102

Closed RCady closed 1 year ago

RCady commented 2 years ago

Laravel's artisan test command offers some styling upgrades on top of PHPUnit's. artisan test passes all arguments directly to PHPUnit.

It would be nice to add Laravel/Artisan detection and adjust the command to utilize this.

I plan to create a Pull Request with the changes in the near future.

gerardroche commented 2 years ago

Currently you can toggle the --testdox option from the command palette which will give you a similar output.

gerardroche commented 1 year ago

One way to hack it is the following:

    "phpunit.prepend_cmd": ["artisan"],
    "phpunit.executable": "test",
    "phpunit.options":
    {
        "colors=never": true,
    },

This prepends artisan and replaces the executable with test which gets you artisan test. A bit hacky but works.

The colors option is required because artisan prints colors codes. PHPUnit defaults to --colors=auto which disables colors when run in Sublime Text.

The problem is that artisan still prints some color codes which is similar to the same issue Pest has (see https://github.com/gerardroche/sublime-phpunit/issues/103):

Screenshot from 2023-04-08 13-07-54

It also prints a TTY warning that I don't understand yet:

Warning: TTY mode requires /dev/tty to be read/writable.
gerardroche commented 1 year ago

In the next version you will be able to set the executable as a list:

    "phpunit.executable": ["artisan", "test"],
    "phpunit.options":
    {
        "colors=never": true,
    },
gerardroche commented 1 year ago

I added the boolean setting phpunit.artisan. Just set it to true to enable the Artisan test runner.

I opened an issue in the Laravel tracker for the color output issues: https://github.com/laravel/framework/issues/46759.

Please open issues about missing syntax highlighting of the output.