guard library
A test that keeps rebuildcop out of the app.
The package depends on flutter_test, so it belongs in
dev_dependencies and must never be imported from lib/, or test code
is compiled into release builds. Add one test to the app's suite to
enforce that:
// test/rebuild_budget_guard_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:rebuildcop/guard.dart';
void main() =>
test('rebuild budgets stay out of the app', expectRebuildBudgetIsTestOnly);
To check before flutter test runs, for example as an early CI step, use
dart run rebuildcop:check, which does the same.
Functions
-
expectRebuildBudgetIsTestOnly(
{String? packageRoot}) → void -
Fails the test if the app lists
rebuildcopunderdependenciesor imports it fromlib/.