mix ab.test (AB v0.2.1)
View SourceMix task that compiles Elixir files, extracts modules, and runs AB.property_test on their exported functions.
Usage
mix ab.test path/to/file.ex
mix ab.test path/to/directoryExamples
# Test a single file
mix ab.test lib/my_module.ex
# Test all .ex files in a directory recursively
mix ab.test lib/
# Test with verbose output
mix ab.test lib/my_module.ex --verbose
# Show only failures in a structured format
mix ab.test lib/my_module.ex --failures-only
# Skip functions without typespecs (soft mode)
mix ab.test lib/my_module.ex --soft
# Test all files in a directory with soft mode
mix ab.test lib/ --softOptions
--verbose,-v: Enable verbose output showing input/output for each test--failures-only,-f: Show only failed tests in a structured format with:- Function name
- Why it failed
- Incorrect typespec
- Expected typespec
- File path and line number
--soft,-s: Skip functions without typespecs instead of erroring out
This task will:
- Compile the specified Elixir file(s) or all .ex files in a directory (recursively)
- Extract the module from each compiled file
- Find all exported functions with typespecs
- Run AB.property_test on each function
- Error out if functions without typespecs are found (unless --soft flag is used)
When processing directories, the task will:
- Recursively find all .ex files
- Skip hidden directories (starting with .)
- Skip common build directories (_build, deps, node_modules)