build_verify
3.1.1, released a year ago by kevmoo.com
Utility to verify generated Dart code is up-to-date during build
What it does
It runs build_runner and checks for uncommitted changes in generated files. If any differences are found, the test fails.
AI-written summary of version 3.1.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You use build_runner to generate code and want to ensure it stays in sync
- You want to add a CI check that fails when generated code is stale
- You need a quick way to assert clean builds in unit tests
Skip it when
- You are not using build_runner or code generation
- Your project is not under Git version control
- You need a more sophisticated diff or linting tool
Strengths
- Simple API, just a single test function
- Async and works with flutter test
- Prints executed commands for debugging
- Supports custom git diff arguments
Weaknesses
- Requires Git repository to run
- Depends on build_runner being configured
- Requires Dart >=3.4.0 for latest version
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Add a test file with `test('ensure_build', expectBuildClean);` and ensure build_runner is set up in pubspec
import 'package:build_verify/build_verify.dart';
import 'package:test/test.dart';
void main() {
test('ensure_build', expectBuildClean);
}Alternatives
Packages that do the same job and could replace build_verify.
- build_test
Utilities for unit testing Dart build_runner builders in memory
78Compare - bdd_framework
Create BDD tests in Dart code with readable error messages and Gherkin feature file export.
77Compare - golden_screenshot
Utilities to automate screenshot generation using Flutter's golden tests.
76Compare - autopilot
A test driver for Flutter that exposes a JSON HTTP API for QA testing.
66Compare
Works with
Packages commonly used together with build_verify: ones it builds on, ones built on it, and its own family.
- iobuild_verify depends on itUtilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
- testbuild_verify depends on itA full featured library for writing and running Dart tests across platforms.
- build_versionSame familyGenerate a Dart file with the package version at build time.
- build_cliSame familyParse command line arguments directly into an annotation class using build_runner or a standalone CLI.