testing library

Architecture checks for your test suite.

import 'package:arch_guard/testing.dart';
import 'package:test/test.dart'; // or flutter_test

void main() {
  test('architecture', () async {
    await expectArchitecture();
  });
}

Uses the project's arch_guard.yaml and arch_guard_baseline.json, and fails exactly when the arch_guard CLI would exit with 1.

Classes

ArchAnalysis
One full arch_guard run: scan, cycles, layer and package rules, baseline.

Functions

expectArchitecture({String projectPath = '.', bool failOnCycle = true, bool useBaseline = true, List<String> scanDirs = const ['lib'], List<String> exclude = const [], bool enableWorkspace = true, String? since}) → Future<ArchAnalysis>
Runs arch_guard on projectPath and throws ArchitectureViolationException if it finds problems.

Exceptions / Errors

ArchitectureViolationException
Thrown by expectArchitecture when the project breaks its rules.
GitException
A git command needed by --since failed.