Skip to content

test(pm): expand cache clean matching coverage - #3283

Open
JiChen000 wants to merge 2 commits into
utooland:nextfrom
JiChen000:feat/issue-3169-clean-matching-tests
Open

JiChen000 wants to merge 2 commits into
utooland:nextfrom
JiChen000:feat/issue-3169-clean-matching-tests

Conversation

@JiChen000

Copy link
Copy Markdown

Closes #3169

Summary

Expand test coverage for utoo clean cache matching. Extract collect_cache_entries_from(cache_dir, pattern) as a testable core of collect_cache_entries (the global cache dir is process-config state) and cover regular/scoped packages, wildcards, and deterministic sorting. Behavior unchanged.

Changes

  • Extract collect_cache_entries_from(cache_dir, pattern) from collect_cache_entries
  • Add tests for regular packages, scoped packages (@types/node), scoped wildcards, name/version wildcards and scoped+version specs
  • Add a deterministic sort test with a 10.0.0 fixture pinning lexical version ordering

Test Plan

  • cargo test -p utoo-pm: 8 new tests pass
  • utoo clean <pattern> -y against a temp UTOO_CACHE_DIR matches and lists entries in the same sorted order

Extract collect_cache_entries_from(cache_dir, pattern) as a testable core
of collect_cache_entries and cover regular/scoped packages, name/version
wildcards, and deterministic name+version sorting (pinning lexical version
order with a 10.0.0 fixture) against an unordered layout. Behavior
unchanged.
@JiChen000

Copy link
Copy Markdown
Author

#3169

Comment thread crates/pm/src/service/clean_cache.rs Outdated
@elrrrrrrr

Copy link
Copy Markdown
Contributor

需要 e2e 验证 case

Revert the collect_cache_entries_from extraction (avoid a one-line wrapper
per code-guard A18) and cover cache matching with subprocess e2e tests
against the real binary via UTOO_CACHE_DIR: regular/scoped patterns,
name/version wildcards, deterministic output order (pinned with a 10.0.0
lexical-sort fixture) and the no-match empty-summary path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(pm): expand cache clean matching coverage / 补充 clean 缓存匹配测试

2 participants