paratestphp / paratest

:computer: Parallel testing for PHPUnit
MIT License
2.32k stars 229 forks source link

[6.x] PHP Fatal error: Uncaught ValueError: str_repeat() #865

Open millnut opened 4 months ago

millnut commented 4 months ago

Paratest returns this error when a test fails

ParaTest v6.11.1 upon PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

PHP Fatal error:  Uncaught ValueError: str_repeat(): Argument #2 ($times) must be greater than or equal to 0 in /app/vendor/brianium/paratest/src/Logging/JUnit/Reader.php:109
Stack trace:
#0 /app/vendor/brianium/paratest/src/Logging/JUnit/Reader.php(109): str_repeat('.', -1)
#1 /app/vendor/brianium/paratest/src/Runners/PHPUnit/ResultPrinter.php(403): ParaTest\Logging\JUnit\Reader->getFeedback()
#2 /app/vendor/brianium/paratest/src/Runners/PHPUnit/ResultPrinter.php(305): ParaTest\Runners\PHPUnit\ResultPrinter->processReaderFeedback(Object(ParaTest\Logging\JUnit\Reader), 1)
#3 /app/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php(108): ParaTest\Runners\PHPUnit\ResultPrinter->printFeedback(Object(ParaTest\Runners\PHPUnit\TestMethod))
#4 /app/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php(41): ParaTest\Runners\PHPUnit\Runner->testIsStillRunning(Object(ParaTest\Runners\PHPUnit\Worker\RunnerWorker))
#5 /app/vendor/brianium/paratest/src/Runners/PHPUnit/BaseRunner.php(80): ParaTest\Runners\PHPUnit\Runner->doRun()
#6 /app/vendor/brianium/paratest/src/Console/Commands/ParaTestCommand.php(102): ParaTest\Runners\PHPUnit\BaseRunner->run()
#7 /app/vendor/symfony/console/Command/Command.php(326): ParaTest\Console\Commands\ParaTestCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /app/vendor/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /app/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(ParaTest\Console\Commands\ParaTestCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /app/vendor/brianium/paratest/bin/paratest(37): Symfony\Component\Console\Application->run()
#12 /app/vendor/bin/paratest(119): include('/app/vendor/bri...')
#13 {main}
  thrown in /app/vendor/brianium/paratest/src/Logging/JUnit/Reader.php on line 109

Fatal error: Uncaught ValueError: str_repeat(): Argument #2 ($times) must be greater than or equal to 0 in /app/vendor/brianium/paratest/src/Logging/JUnit/Reader.php:109
Stack trace:
#0 /app/vendor/brianium/paratest/src/Logging/JUnit/Reader.php(109): str_repeat('.', -1)
#1 /app/vendor/brianium/paratest/src/Runners/PHPUnit/ResultPrinter.php(403): ParaTest\Logging\JUnit\Reader->getFeedback()
#2 /app/vendor/brianium/paratest/src/Runners/PHPUnit/ResultPrinter.php(305): ParaTest\Runners\PHPUnit\ResultPrinter->processReaderFeedback(Object(ParaTest\Logging\JUnit\Reader), 1)
#3 /app/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php(108): ParaTest\Runners\PHPUnit\ResultPrinter->printFeedback(Object(ParaTest\Runners\PHPUnit\TestMethod))
#4 /app/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php(41): ParaTest\Runners\PHPUnit\Runner->testIsStillRunning(Object(ParaTest\Runners\PHPUnit\Worker\RunnerWorker))
#5 /app/vendor/brianium/paratest/src/Runners/PHPUnit/BaseRunner.php(80): ParaTest\Runners\PHPUnit\Runner->doRun()
#6 /app/vendor/brianium/paratest/src/Console/Commands/ParaTestCommand.php(102): ParaTest\Runners\PHPUnit\BaseRunner->run()
#7 /app/vendor/symfony/console/Command/Command.php(326): ParaTest\Console\Commands\ParaTestCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /app/vendor/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /app/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(ParaTest\Console\Commands\ParaTestCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /app/vendor/brianium/paratest/bin/paratest(37): Symfony\Component\Console\Application->run()
#12 /app/vendor/bin/paratest(119): include('/app/vendor/bri...')
#13 {main}
  thrown in /app/vendor/brianium/paratest/src/Logging/JUnit/Reader.php on line 109

phpunit (same test, but this error is shown)

PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

Testing /app/web/profiles/contrib/localgov
F                                                                   1 / 1 (100%)R

Time: 00:15.065, Memory: 10.00 MB

There was 1 failure:

1) Drupal\Tests\localgov\Functional\LocalGovUpdateTest::testUpdate
Test was run in child process and ended unexpectedly

/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
/app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651
/app/vendor/phpunit/phpunit/src/TextUI/Command.php:146
/app/vendor/phpunit/phpunit/src/TextUI/Command.php:99

--

There was 1 risky test:

1) Drupal\Tests\localgov\Functional\LocalGovUpdateTest::testUpdate
This test did not perform any assertions

/app/web/core/tests/Drupal/Tests/Listeners/DrupalListener.php:62
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:453
/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:685
/app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:651
/app/vendor/phpunit/phpunit/src/TextUI/Command.php:146
/app/vendor/phpunit/phpunit/src/TextUI/Command.php:99

FAILURES!
Tests: 1, Assertions: 0, Failures: 1, Risky: 1.

This hides other test errors when this occurs on a CI workflow and makes it difficult to see what tests have actually failed

github-actions[bot] commented 2 months ago

This issue has gone two months without activity. In another two weeks, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Backlog or In Progress, I will leave it alone ... forever!

staabm commented 1 month ago

could you provide a small reproducing example?