open-southeners/phpunit-todo-markdown-printer

Print your failed tests as a to do list in Markdown format

1.1.0 2022-12-21 13:30 UTC

This package is auto-updated.

Last update: 2024-04-21 16:37:01 UTC


README

Print your failed tests as a to do list in Markdown format

Status

latest tag packagist version required php version phpstan Laravel Pint Codacy Badge Edit on VSCode online

Getting started

composer require open-southeners/phpunit-todo-markdown-printer

Configuration

Add the following to your phpunit.xml:

  <listeners>
    <listener class="OpenSoutheners\PHPUnitTodoMarkdownPrinter\Printer">
      <arguments>
        <string name="out">todo_failed_tests.md</string>
        <boolean name="reportRiskyTests">true</boolean>
        <boolean name="reportIncompleteTests">true</boolean>
        <boolean name="reportSkippedTests">true</boolean>
      </arguments>
    </listener>
  </listeners>

And that's all you need to do, from now on your todo_failed_tests.md will have the markdown similar as the one below.

Example output

Code

# Failed tests

A summary of tests that failed. **Total of 1 failed within 1 files**.

## CommentControllerTest

- [ ] test_that_fails_mostly

```
Call to a member function getKey() on null

at /Users/my_user/Projects/my_project/app/Notifications/Notification.php:34
----------
#0 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestCase.php(904): PHPUnit\Framework\TestResult->run(Object(Tests\Integration\Http\Controllers\Api\CommentControllerTest))
#1 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#2 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#3 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#4 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(661): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#5 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(144): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
#6 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(97): PHPUnit\TextUI\Command->run(Array, true)
#7 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/phpunit(98): PHPUnit\TextUI\Command::main()
#8 {main}
```

Preview

Failed tests

A summary of tests that failed. Total of 1 failed within 1 files.

CommentControllerTest

  • test_that_fails_mostly
Call to a member function getKey() on null

at /Users/my_user/Projects/my_project/app/Notifications/Notification.php:34
----------
#0 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestCase.php(904): PHPUnit\Framework\TestResult->run(Object(Tests\Integration\Http\Controllers\Api\CommentControllerTest))
#1 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#2 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#3 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#4 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(661): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#5 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(144): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
#6 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(97): PHPUnit\TextUI\Command->run(Array, true)
#7 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/phpunit(98): PHPUnit\TextUI\Command::main()
#8 {main}