PHP code example of capell-app / pest-plugin-blade-coverage

1. Go to this page and download the library: Download capell-app/pest-plugin-blade-coverage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

capell-app / pest-plugin-blade-coverage example snippets




declare(strict_types=1);

return [
    '],
    'exclude' => [],
    'baseline' => 'tests/BladeCoverage/baseline.json',
    'cache' => '.cache/pest-blade-coverage',

    // How uncovered views are grouped in the console output:
    // 'auto' (default) | 'package' | 'directory' | 'flat'.
    'group_by' => 'auto',

    // 'baseline' (default) ratchets against the committed baseline.
    // 'strict' ignores the baseline and fails on ANY uncovered view.
    'mode' => 'baseline',

    // Optionally fail when the covered percentage drops below this threshold.
    'min_coverage' => null,
];

'    'resources/views/**/*.blade.php',
    'packages/*/resources/views/**/*.blade.php',
],

use Capell\PestBladeCoverage\BladeCoverage;

$rendered = BladeCoverage::capture(fn () => view('dashboard')->render());
// ['resources/views/dashboard.blade.php']

expect(BladeCoverage::rendered('resources/views/dashboard.blade.php',
    fn () => $this->get('/dashboard')))->toBeTrue();
bash
vendor/bin/pest --blade-coverage --blade-coverage-config=tests/custom-blade-coverage.php
json
{
    "schemaVersion": 1,
    "generatedAt": "2026-06-01T17:00:00+00:00",
    "summary": {
        "total": 174,
        "covered": 22,
        "uncovered": 152,
        "baselineAllowed": 152,
        "newUncovered": 0,
        "changedUncovered": 0
    },
    "config": {
        "