graphql-go / graphql-go/graphql

Increase tests coverage.

Open
#751 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

# Coverage Analysis

**Overall coverage: 80.8%** (5,326 covered / 6,588 statements, 1,262 uncovered)

---

## Files with highest impact on overall coverage (excluding test/bench/examples)

| File | Coverage | Uncovered | Total Stmts | Impact if 100% |
|------|----------|-----------|-------------|----------------|
| `language/ast/type_definitions.go` | 0.0% | 91 | 91 | +1.38pp |
| `language/ast/values.go` | 0.0% | 57 | 57 | +0.87pp |
| `plan_cache_normalize.go` | 80.1% | 44 | 221 | +0.67pp |
| `language/ast/definitions.go` | 0.0% | 43 | 43 | +0.65pp |
| `language/visitor/visitor.go` | 90.6% | 29 | 310 | +0.44pp |
| `plan.go` | 92.8% | 27 | 373 | +0.41pp |
| `language/ast/selections.go` | 0.0% | 25 | 25 | +0.38pp |
| `language/ast/types.go` | 0.0% | 19 | 19 | +0.29pp |
| `schema.go` | 92.3% | 18 | 235 | +0.27pp |
| `plan_cache.go` | 81.1% | 18 | 95 | +0.27pp |
| `language/location/location.go` | 0.0% | 16 | 16 | +0.24pp |
| `rules.go` | 97.8% | 16 | 730 | +0.24pp |
| `values.go` | 92.7% | 14 | 191 | +0.21pp |
| `subscription.go` | 84.5% | 11 | 71 | +0.17pp |
| `rules_overlapping_fields_can_be_merged.go` | 96.7% | 9 | 269 | +0.14pp |
| `util.go` | 89.7% | 9 | 87 | +0.14pp |
| `scalars.go` | 97.1% | 8 | 273 | +0.12pp |
| `language/ast/name.go` | 0.0% | 6 | 6 | +0.09pp |
| `language/ast/arguments.go` | 0.0% | 6 | 6 | +0.09pp |
| `type_info.go` | 96.1% | 5 | 128 | +0.08pp |
| `validator.go` | 95.4% | 5 | 108 | +0.08pp |
| `language/source/source.go` | 0.0% | 5 | 5 | +0.08pp |
| `language/ast/document.go` | 0.0% | 5 | 5 | +0.08pp |
| `language/ast/directives.go` | 0.0% | 5 | 5 | +0.08pp |
| `language/ast/location.go` | 0.0% | 3 | 3 | +0.05pp |
| `graphql.go` | 88.9% | 3 | 27 | +0.05pp |
| `located.go` | 94.4% | 1 | 18 | +0.02pp |
| `language/lexer/lexer.go` | 99.6% | 1 | 282 | +0.02pp |

---

## Key takeaways

### Best targets for real logic (not just type definitions)

1. **`plan_cache_normalize.go`** — 80.1% coverage, 44 uncovered. Biggest code-level gap with actual logic.
2. **`plan.go`** — 92.8% coverage, 27 uncovered. High statement count, core execution logic.
3. **`language/visitor/visitor.go`** — 90.6% coverage, 29 uncovered. Core AST traversal.
4. **`schema.go`** — 92.3% coverage, 18 uncovered. Schema building logic.
5. **`plan_cache.go`** — 81.1% coverage, 18 uncovered. Caching logic.
6. **`subscription.go`** — 84.5% coverage, 11 uncovered. Subscription execution.
7. **`util.go`** — 89.7% coverage, 9 uncovered. Utility functions.
8. **`values.go`** — 92.7% coverage, 14 uncovered. Value coercion/resolution.

These files contain actual logic and edge cases that aren't covered by existing tests.

### Bulk coverage wins (`language/ast/*`)

The `language/ast/` files (type_definitions, values, definitions, selections, types, etc.) collectively account for **~255 uncovered statements at 0% coverage** (~20% of all uncovered code). These are primarily struct/type definitions used across the codebase. They would give the biggest numerical boost (+3.7pp total) but require adding AST package-level tests that exercise these types directly.

Contributor guide

Open the contributing guide

Research direction

Start by running the Go test coverage analysis and reviewing the listed targets, especially plan_cache_normalize.go, plan.go, language/visitor/visitor.go, and schema.go. Add tests for uncovered logic or AST types, then rerun coverage to verify that the selected gaps are covered and the overall percentage improves.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, graphql
Domain
backend-api-design, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.