test(update): isolate stamp writes from real ~/.lark-cli/skills.stamp#858
Conversation
Five tests in cmd/update mocked SkillsUpdateOverride to return success
and let runSkillsAndStamp call WriteStamp, but did not isolate
LARKSUITE_CLI_CONFIG_DIR. Each run clobbered the real
~/.lark-cli/skills.stamp with the mock version ("2.0.0" or "1.0.0"),
causing skillscheck to fire a misleading drift notice on every
subsequent lark-cli invocation.
Add t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) at the top of:
- TestUpdateNpm_JSON
- TestUpdateNpm_Human
- TestUpdateForce_JSON
- TestUpdateDevVersion_JSON
- TestUpdateWindows_NpmSuccess_JSON
Scope is limited to tests that mock SkillsUpdateOverride to success;
tests that invoke real npx are pre-existing and out of scope here.
Change-Id: I7a78a6c70f276b51333253acc115e0109c01a851
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFive test cases in the update module are updated to isolate filesystem side effects by setting ChangesTest Filesystem Isolation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #858 +/- ##
=======================================
Coverage 65.85% 65.85%
=======================================
Files 517 517
Lines 48761 48761
=======================================
Hits 32113 32113
Misses 13885 13885
Partials 2763 2763 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@7641a3ba51d7adda20fd00001169e2ea9a399f17🧩 Skill updatenpx skills add larksuite/cli#fix/update-test-stamp-isolation -y -g |
…larksuite#858) Five tests in cmd/update mocked SkillsUpdateOverride to return success and let runSkillsAndStamp call WriteStamp, but did not isolate LARKSUITE_CLI_CONFIG_DIR. Each run clobbered the real ~/.lark-cli/skills.stamp with the mock version ("2.0.0" or "1.0.0"), causing skillscheck to fire a misleading drift notice on every subsequent lark-cli invocation. Add t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) at the top of: - TestUpdateNpm_JSON - TestUpdateNpm_Human - TestUpdateForce_JSON - TestUpdateDevVersion_JSON - TestUpdateWindows_NpmSuccess_JSON Scope is limited to tests that mock SkillsUpdateOverride to success; tests that invoke real npx are pre-existing and out of scope here. Change-Id: I7a78a6c70f276b51333253acc115e0109c01a851
Summary
cmd/update/update_test.gomockedSkillsUpdateOverrideto return success and letrunSkillsAndStampcallWriteStamp, but did not isolateLARKSUITE_CLI_CONFIG_DIR. Each run clobbered the real~/.lark-cli/skills.stampwith the mocked version (`"2.0.0"` or `"1.0.0"`), causingskillscheck.Initto fire a misleading drift notice (`lark-cli skills X out of sync with binary Y`) on every subsequent invocation.Test plan
Summary by CodeRabbit