SexySpex.ErrorCapture (sexy_spex v0.2.0)
View SourceCaptures error logs during spex execution.
This module provides a way to detect if any error logs were emitted during test execution, allowing spex to fail if errors occur even if no assertion failed.
Usage
In your spex file, enable error capture:
use SexySpex, fail_on_error_logs: trueOr start/stop manually:
SexySpex.ErrorCapture.start()
# ... run tests ...
errors = SexySpex.ErrorCapture.get_errors()
SexySpex.ErrorCapture.stop()How It Works
Uses an ETS table to store captured errors and a custom Logger handler to intercept error-level log messages.
Summary
Functions
Checks for errors and raises if any were found.
Returns a specification to start this module under a supervisor.
Clears all captured errors.
Returns error count.
Formats captured errors for display.
Returns all captured errors.
Returns true if any errors were captured.
Starts the error capture process and installs the Logger handler.
Stops the error capture process and removes the Logger handler.
Functions
Checks for errors and raises if any were found.
Returns a specification to start this module under a supervisor.
See Supervisor.
Clears all captured errors.
Returns error count.
Formats captured errors for display.
Returns all captured errors.
Returns true if any errors were captured.
Starts the error capture process and installs the Logger handler.
Stops the error capture process and removes the Logger handler.