Skip to content

Add comprehensive testing for CLI args config override behavior #16

Description

@brooksmtownsend

Description

The configuration loading system needs more comprehensive testing to ensure that CLI arguments properly override existing configuration values without replacing present values with empty values.

Location

crates/wash/src/config.rs:153 in the load_config function

Current Behavior

The load_config function implements a hierarchical configuration system with this precedence:

  1. Default values
  2. Global config (~/.wash/config.json)
  3. Local project config (.wash/config.json)
  4. Environment variables (WASH_ prefix)
  5. Command line arguments (highest priority)

However, there's incomplete testing to ensure CLI args behave correctly when overriding existing configuration.

Problem

The current implementation may have issues where:

  • CLI args with empty/default values might replace valid configured values
  • Partial CLI config objects might override entire config sections
  • Edge cases in the merge behavior aren't properly tested

Proposed Solution

Add comprehensive test coverage for:

  1. Selective override testing: Verify CLI args only override specified fields
  2. Empty value handling: Ensure empty CLI values don't replace valid config values
  3. Nested config merging: Test deep merging behavior for complex config structures
  4. Edge cases: Test various combinations of config sources

Example Test Cases

#[test]
fn test_cli_args_selective_override() {
    // Verify that setting only one CLI arg doesn't clear other configured values
}

#[test] 
fn test_cli_args_empty_values() {
    // Verify empty CLI values don't override existing valid config
}

Context

This is critical for ensuring users can rely on CLI arguments working as expected without inadvertently breaking their saved configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions