PHPackages                             worksome/pest-graphql-coverage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. worksome/pest-graphql-coverage

ActiveLibrary[Testing &amp; Quality](/categories/testing)

worksome/pest-graphql-coverage
==============================

A plugin for Pest to add GraphQL coverage via Lighthouse

v0.3.10(2mo ago)6304.9k↑23.8%[1 PRs](https://github.com/worksome/pest-graphql-coverage/pulls)MITPHPPHP ^8.4CI passing

Since Feb 1Pushed 2mo ago9 watchersCompare

[ Source](https://github.com/worksome/pest-graphql-coverage)[ Packagist](https://packagist.org/packages/worksome/pest-graphql-coverage)[ Docs](https://github.com/worksome/pest-graphql-coverage)[ RSS](/packages/worksome-pest-graphql-coverage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (23)Used By (0)

PestPHP GraphQL Coverage
========================

[](#pestphp-graphql-coverage)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e2da9f8f964a06a9b1004c054269bff33e7f000ea68a76d86228881663db91f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776f726b736f6d652f706573742d6772617068716c2d636f7665726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/worksome/pest-graphql-coverage)[![Total Downloads](https://camo.githubusercontent.com/4e4439af33f6e9d41278659f1d5250daab273467243e8904a3fc57f926a24df9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776f726b736f6d652f706573742d6772617068716c2d636f7665726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/worksome/pest-graphql-coverage)

This plugin adds support for showing the coverage of the GraphQL schema (Lighthouse only).

**Supports Pest 3 and Pest 4** - automatically detects and works with both versions.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require --dev worksome/pest-graphql-coverage
```

Usage
-----

[](#usage)

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
```

### Setting coverage limits

[](#setting-coverage-limits)

By adding the argument `--gql-min=`, we can limit to have a min coverage of x.

```
php artisan test --gql-coverage --gql-min=60
```

### Setting the number of output fields

[](#setting-the-number-of-output-fields)

By adding the argument `--gql-untested-count=`, we can increase or reduce the number of untested fields that are output.

```
php artisan test --gql-coverage --gql-untested-count=25
```

### Changing default schema fetching command

[](#changing-default-schema-fetching-command)

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"
```

### Excluding nodes from total coverage

[](#excluding-nodes-from-total-coverage)

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.

```
