mix ab.test (AB v0.2.1)

View Source

Mix 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/directory

Examples

# 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/ --soft

Options

  • --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:

  1. Compile the specified Elixir file(s) or all .ex files in a directory (recursively)
  2. Extract the module from each compiled file
  3. Find all exported functions with typespecs
  4. Run AB.property_test on each function
  5. 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)