# source_gen_test

> Test Dart code generators built on source_gen by annotating test files

Source: https://talira.ai/catalog/source-gen-test-4rzqxv1g
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / testing](https://talira.ai/categories/developer-tools/testing), [languages / dart](https://talira.ai/categories/languages/dart)
- Licence: MIT[^2]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Kevin Moore](https://talira.ai/orgs/kevin-moore.md)

source_gen_test makes it easy to test Dart code generators derived from package:source_gen. You annotate classes in a test library with the output a generator should produce (@ShouldGenerate), the error it should throw (@ShouldThrow) or a golden file to compare against (@ShouldGenerateFile), each for one or more generator configurations. verifyGeneratorBatch runs large matrices of declaration permutations against a generator in one shared analyzer context, and the package bundles an agent skill for stress-testing generators that way.

## Links

- GitHub: https://github.com/kevmoo/source_gen_test

## Problems it solves

- write tests for my Dart source_gen code generator
- check a Dart generator's output against a golden file
- test that my code generator throws the right error for bad input

## Features

- @ShouldGenerate and @ShouldThrow annotations for generator tests
- golden-file tests with @ShouldGenerateFile
- verifyGeneratorBatch for combinatorial generator testing
- bundled source-gen-test-fuzz agent skill

## Trust

Overall: 0.38 out of 1.
Signals: maintenance 0.71, adoption 0.26, momentum 0.03, community 0.28, backing 0.30, extensibility 0.00.

- last commit 6 days ago
- 16 commits in the last 90 days
- latest release v1.4.2 44 days ago
- 20 GitHub stars
- 4 contributors
- backed by Kevin Moore

## Related

- Works with [source_gen](https://talira.ai/catalog/source-gen-mphgdz39.md)

## Alternatives

- [build_verify](https://talira.ai/catalog/build-verify-e9f16tvq.md): Test that generated Dart code is up to date

## Sources

[^1]: https://github.com/kevmoo/source_gen_test#readme (checked 28 Nov 2026)
[^2]: https://github.com/kevmoo/source_gen_test/blob/main/LICENSE (checked 28 Nov 2026)
