diff --git a/lib/clean/caches.sh b/lib/clean/caches.sh index 3087179..cdfe86a 100644 --- a/lib/clean/caches.sh +++ b/lib/clean/caches.sh @@ -184,7 +184,6 @@ clean_project_caches() { -not -path "*/Library/*" \ -not -path "*/.Trash/*" \ -not -path "*/node_modules/*" \ - -not -path "*/.*" \ -not -path "*/.fvm/*" \ 2> /dev/null || true ) > "$flutter_tmp_file" 2>&1 & diff --git a/tests/clean_dev_caches.bats b/tests/clean_dev_caches.bats index da4e5b3..c15ede5 100644 --- a/tests/clean_dev_caches.bats +++ b/tests/clean_dev_caches.bats @@ -112,3 +112,25 @@ EOF [[ "$output" == *"npm"* ]] [[ "$output" == *"brew"* ]] } + +@test "clean_project_caches cleans flutter .dart_tool and build directories" { + mkdir -p "$HOME/Code/flutter_app/.dart_tool" "$HOME/Code/flutter_app/build" + touch "$HOME/Code/flutter_app/.dart_tool/cache.bin" + touch "$HOME/Code/flutter_app/build/output.bin" + + run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc <<'EOF' +set -euo pipefail +source "$PROJECT_ROOT/lib/core/common.sh" +source "$PROJECT_ROOT/lib/clean/caches.sh" +start_inline_spinner() { :; } +stop_inline_spinner() { :; } +create_temp_file() { mktemp; } +safe_clean() { echo "$2|$1"; } +DRY_RUN=false +clean_project_caches +EOF + + [ "$status" -eq 0 ] + [[ "$output" == *"Flutter build cache (.dart_tool)"* ]] + [[ "$output" == *"Flutter build cache (build/)"* ]] +}