pestphp / pest-plugin-watch

The Pest Plugin Watch
https://pestphp.com
MIT License
17 stars 10 forks source link

Running Pest with the Watch Plugin does not display colorful output #24

Open paulshryock opened 9 months ago

paulshryock commented 9 months ago

Summary

The Pest Watch Plugin removes colorful output from Pest.

✅ Expected behavior ❌ Actual behavior
1. Install Pest and Pest Plugin Watch 1. Install Pest and Pest Plugin Watch
2. Run vendor/bin/pest --watch 2. Run vendor/bin/pest --watch
3. See test output with colors 3. See test output with no colors

Screenshots

vendor/bin/pest does have colorful output vendor/bin/pest --watch does not have colorful output
Screenshot 2023-11-15 at 2 49 56 PM Screenshot 2023-11-15 at 2 50 49 PM

Steps to recreate

# Create a project
$ mkdir -p my-app
$ cd my-app

# Initialize Composer
$ composer init

# Install and initialize Pest 2.x
$ composer require --dev pestphp/pest:2.x -W
$ vendor/bin/pest --init

# Install Pest Plugin Watch 2.x
$ composer require --dev pestphp/pest-plugin-watch:2.x -W

# Check PHP version
$ php --version
PHP 8.2.12 (cli) (built: Nov  5 2023 21:48:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies

# Check Pest and plugin versions
$ composer show | grep pest
pestphp/pest                        v2.24.3 The elegant PHP Testing Framework.
pestphp/pest-plugin                 v2.1.1  The Pest plugin manager
pestphp/pest-plugin-arch            v2.4.1  The Arch plugin for Pest PHP.
pestphp/pest-plugin-watch           v2.0.1  The Pest Watch Plugin

# Add a simple test, run it and do see colorful output (see screenshot above)
$ vendor/bin/pest

# Run test with Watch Plugin and do not see colorful output (see screenshot above)
$ vendor/bin/pest --watch

Example files

composer.json:

{
    "autoload": {
        "psr-4": {
            "MyOrg\\MyApp\\": "src/"
        }
    },
    "scripts": {
        "test": "pest"
    },
    "require-dev": {
        "pestphp/pest": "2.x",
        "pestphp/pest-plugin-watch": "2.x"
    },
    "config": {
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    }
}

src/MyClass.php:

<?php

declare(strict_types=1);

namespace MyOrg\MyApp;

final class MyClass {}

tests/Unit/MyClassTest.php:

<?php

declare(strict_types=1);

namespace MyOrg\MyApp;

use Exception;

describe(MyClass::class, function() {
  it('should instantiate', function() {
    expect(fn() => new MyClass())->not->toThrow(Exception::class);
  });
});