1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-17 13:15:26 +00:00

fix(clean): ensure flutter .dart_tool caches are discovered

This commit is contained in:
tw93
2026-02-15 08:03:38 +08:00
parent 744ecec4ba
commit c896163d4b
2 changed files with 22 additions and 1 deletions

View File

@@ -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 &

View File

@@ -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/)"* ]]
}