# cargo-mutants configuration for the announcement crate # # This configuration optimizes mutation testing by: # - Focusing on correctness-critical code # - Excluding low-value mutations # - Setting appropriate timeouts # - Configuring parallel execution # Overall timeout for each mutant test # Increased from default to handle blocking tests timeout = 300 # 5 minutes per mutant # Number of parallel jobs # Set to number of CPU cores for faster execution # jobs = 8 # Uncomment and adjust for your system # Test tool to use # nextest is faster than cargo test test_tool = "nextest" # Additional arguments to pass to the test command # --no-fail-fast ensures all tests run even if one fails test_args = ["--no-fail-fast"] # Exclude patterns for files that shouldn't be mutated # These are low-value targets that produce noise exclude_globs = [ # Test files - we test the tests, not mutate them "tests/**", "benches/**", "examples/**", # Build scripts "build.rs", ] # Exclude specific functions/methods that shouldn't be mutated # These are low-value mutations that don't test correctness [[exclude_functions]] # Display trait implementations - not correctness-critical regex = ".*::fmt" reason = "Display/Debug implementations don't affect correctness" [[exclude_functions]] # Clone implementations - trivial mutations regex = ".*::clone" reason = "Clone implementations are trivial" # Error message constants - string content doesn't affect correctness # (cargo-mutants doesn't mutate string literals anyway, but documenting intent) # Specific functions to focus on (include) # These are the correctness-critical paths [[examine_functions]] # Core announcement logic regex = "Announcer::announce" reason = "Critical: Core value announcement" [[examine_functions]] # Async waiting logic regex = "Listener::listen$" reason = "Critical: Async wait correctness" [[examine_functions]] # Blocking wait logic regex = "Listener::listen_blocking" reason = "Critical: Blocking wait correctness" [[examine_functions]] # Timeout logic regex = "Listener::listen_timeout_blocking" reason = "Critical: Timeout calculation correctness" [[examine_functions]] # Explicit close regex = "Announcer::close" reason = "Critical: Explicit shutdown path" [[examine_functions]] # Implicit close via Drop regex = "Announcer.*::drop" reason = "Critical: Implicit shutdown path" [[examine_functions]] # State checks regex = "Announcement::is_announced" reason = "Critical: State query correctness" [[examine_functions]] regex = "Announcement::is_closed" reason = "Critical: State query correctness" [[examine_functions]] regex = "Listener::is_closed" reason = "Critical: State query correctness" [[examine_functions]] # Non-blocking check regex = "Listener::try_listen" reason = "Critical: Non-blocking check correctness" # Minimum test time threshold # If tests complete faster than this, warn about insufficient testing # minimum_test_time = 1.0 # Uncomment to enable # Output formats # Generate both text and JSON for tracking # output_formats = ["text", "json"] # Uncomment to enable # Baseline # Compare mutations against a baseline to detect regressions # baseline = "main" # Uncomment to enable baseline comparison # Notes on configuration strategy: # # 1. FOCUS: We explicitly list critical functions to mutate # - This ensures we don't miss important code # - Helps cargo-mutants prioritize what matters # # 2. EXCLUDE: We exclude low-value targets # - Display/Debug impls: String formatting doesn't affect correctness # - Clone impls: Trivial, unlikely to have bugs # - Tests themselves: We test production code, not tests # # 3. TIMEOUT: 5 minutes is generous # - Most mutants complete in seconds # - Allows for blocking tests with timeouts # - Catches actual deadlocks without false positives # # 4. NEXTEST: Faster test execution # - Parallel test execution # - Better output formatting # - Improved reliability # # 5. NO-FAIL-FAST: See all failures # - Don't stop at first test failure # - Get complete picture of mutation impact # - Better for debugging # # Expected mutation counts with this configuration: # - Current: ~25 mutants (baseline) # - Target: ~40-50 mutants (after adding targeted tests) # - Score: 95%+ (up from 92.3%) # # Runtime with this configuration: # - Current: ~5 minutes # - Target: <10 minutes # - With nextest: ~30% faster