A plugin for Pest to add GraphQL coverage via Lighthouse
worksome/pest-graphql-coverage is a Laravel package for a plugin for pest to add graphql coverage via lighthouse.
It currently has 6 GitHub stars and 345.010 downloads on Packagist (latest version v0.3.11).
Install it with composer require worksome/pest-graphql-coverage.
Discover more Laravel packages by worksome
or browse all Laravel packages to compare alternatives.
Last updated
This plugin adds support for showing the coverage of the GraphQL schema (Lighthouse only).
You can install the package via composer:
composer require --dev worksome/pest-graphql-coverage
To enable it simply add --gql-coverage argument to your test command
php artisan test --gql-coverage
It can even be used together with parallel
php artisan test --gql-coverage -p
By adding the argument --gql-min=<percentage>, we can limit to have a min coverage of x.
php artisan test --gql-coverage --gql-min=60
By adding the argument --gql-untested-count=<max>, we can increase or reduce the number of untested fields
that are output.
php artisan test --gql-coverage --gql-untested-count=25
By default, it will fetch the schema using php artisan lighthouse:print-schema, however if you have a
custom command for fetching the schema, that can be used instead by adding --schema-command argument
php artisan test --gql-coverage --schema-command="php artisan lighthouse:print-schema-v2"
By default, all nodes will be included when calculating coverage. However, if you have nodes such as the built-in
Lighthouse pagination types that you do not want to be covered, you can configure ignored fields from your Pest.php configuration file.
<?php
declare(strict_types=1);
use Worksome\PestGraphqlCoverage\Config as GraphQLCoverageConfig;
GraphQLCoverageConfig::new()
->ignore([
'PaginatorInfo.count',
// ...
]);
// Exclude all paginator info nodes
GraphQLCoverageConfig::new()
->ignorePaginatorInfo();
// Exclude all deprecated fields
GraphQLCoverageConfig::new()
->ignoreDeprecatedFields();
This also works natively with Pest (without using Artisan), as it is a Pest plugin.
vendor/bin/pest --gql-coverage
The MIT License (MIT). Please see License File for more information.