ArchTest - Architecture rules as tests. Enforced from bytecode

Small update: ArchTest 0.3.x is ready.

Main things added in 0.3.x:

  • use ArchTest, app: :my_app for app-scoped architecture tests
  • empty rule subjects now fail by default, so typoed patterns dont silently pass
  • freeze: true for easier gradual adoption
  • ArchTest.Collector.calls/2 for function-level call metadata
  • ArchTest.Rule for reusable rules with ignore/freeze support
  • define_slices_by/2 for auto-discovering modulith slices
  • ArchTest.PlantUML.enforce/2 to check component diagrams against real dependencies
  • extra metrics like afferent/2, efferent/2, fan_in/2, fan_out/2, dependency_depth/2
  • better Igniter generators with app scoping and safer defaults

0.3.1 also includes executable examples against a real compiled fixture app, including PlantUML, call metadata, reusable rules, captured slices, and metrics. I added
this becuase docs are nice, but seeing it run against real BEAM files is alot clearer.

Upgrade:

{:arch_test, "~> 0.3", only: :test, runtime: false}

Migration guide from 0.2:
https://hexdocs.pm/arch_test/migrating-to-0.3.html

Docs:
ArchTest v0.3.1 — Documentation

Hex:
arch_test | Hex

Thanks again for the feedback here, it helped shape this release quite a bit.

2 Likes