Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
paulshryock opened this issue Nov 15, 2023 · 0 comments
Open

Comments

@paulshryock
Copy link
Contributor

paulshryock commented Nov 15, 2023

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);
  });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant