mikeerickson / phpunit-pretty-result-printer

PHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!
MIT License
1.2k stars 71 forks source link

Terminal is hanging when starting phpunit on Windows #37

Closed ntraykov closed 6 years ago

ntraykov commented 6 years ago

I just installed the extension and put

<phpunit printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">

in my phpunit.xml

When trying to run phpunit the terminal just hangs. I can stop the script with ctrl+c, so it doesn't freeze the terminal. The problem is, nothing happens.

I am using Windows 10. Tried with the command prompt, Windows Powershell and GitBash.

mikeerickson commented 6 years ago

PHPUnit Version? PHP Version?

ntraykov commented 6 years ago

PHPUnit 6.5.7

PHP 7.1.0 (cli)

mikeerickson commented 6 years ago

If any Windows users can comment on this (have you experienced same issue) please let me know. I will continue to try and reproduce this issue locally

drjekyll commented 6 years ago

I have the same problem.

Windows 10.0.15063 Laravel 5.6 PHPUnit 7.0.2 PHP 7.1.12 (cli)

Adding it to phpunit.xml results in the hang. Running from command line

phpunit --printer=Codedungeon\\PHPUnitPrettyResultPrinter\\Printer

gives "Could not use "Codedungeon\PHPUnitPrettyResultPrinter\Printer" as printer: class does not exist"

mikeerickson commented 6 years ago

Can you please share a screenshot of your expanded vendor directory along with codedungeon expanded

@drjekyll @ntraykov

drjekyll commented 6 years ago

vendor

ntraykov commented 6 years ago

Mine is the same: vendor

Here is how it's hanging: haging

mikeerickson commented 6 years ago

@ntraykov OK, thank you for this information, I will move forward with further testing to reproduce this issue.

peterlupu commented 6 years ago

what about this code here?

Printer::getConfigurationFile()

$continue = true;
while (!file_exists($filename) && $continue):
    if ($this->isWindows()) {
        // WINDOWS SPECIFIC CODE GOES HERE
    } else {
        $filename = $configPath . DIRECTORY_SEPARATOR . $configFileName;
        if ($configPath === '/') {
            $filename = $defaultConfigFilename;
            $continue = false;
        }
        $configPath = \dirname($configPath);
    }

endwhile;

edit: fixed, see pull request #39

mikeerickson commented 6 years ago

This looks good, will be merging PR and tagging this afternoon.

ntraykov commented 6 years ago

Thank you so much, guys!

drjekyll commented 6 years ago

After updating to 7.0 I still get the "class does not exist" when running from the command line. But, when I add the "printerClass" attribute in phpunit.xml it works! It throws a "The system cannot find the path specified." error immediately after typing phpunit - but it works and gives me the pretty output.

erdmenchen commented 6 years ago

Same here. It works but throws a "The system cannot find the path specified" error.

Windows 10 (x64) Version 0.7.0 PHP 7.2.2 PHPUnit 7.0.1

mikeerickson commented 6 years ago

Hey gang, I will be cleaning this mess over the weekend. My apologies

mikeerickson commented 6 years ago

Hey gang, I had time to work on this project before the weekend and have cured the above noted issues. Please upgrade to the 0.8.1 or greater release :-)

@erdmenchen @drjekyll

ntraykov commented 6 years ago

Sorry for the delay. It works perfectly on my side. Thank you! :)

erdmenchen commented 6 years ago

I tried the version 0.8.1 and I am getting the following error now:

PHP Fatal error: Declaration of Codedungeon\ Fatal error: Declaration of Codedungeon\PHPUnitPrettyResultPrinter\Printer::writeProgress($progress) must be compatible with PHPUnit\TextUI\ResultPrinter::writeProgress($progress): void in J:\Users[...]\vendor\codedungeon\phpunit-result-printer\src\Printer.php on line 36

mikeerickson commented 6 years ago

This has been cured by the 0.9.x release posted yesterday

erdmenchen commented 6 years ago

Ok, I tried v0.9.1 but still, the "The system cannot find the path specified." error is printed...

mikeerickson commented 6 years ago

@erdmenchen Hmmm, this is puzzling. I am testing locally and all is working fine? I am curious what differs between our two setups? @peterlupu Any chance you can install 0.9.1 and give this a try.

mikeerickson commented 6 years ago

I have updated the minimum version for this package to PHP 7.1.x, too much hackiness required to support PHP 7.0.x. My apologies for the continued issues, hopefully things will now stabilize.