test: add unit tests for buildProfile style analysis - #262
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe test suite now validates ChangesProfile metric tests
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
404-Page-Found
left a comment
There was a problem hiding this comment.
These tests mutate process-global environment variables (HOME, APPDATA, and XDG_CONFIG_HOME) around an asynchronous buildProfile() call. That can make the suite flaky if tests run concurrently or in a shared process, since other tests may observe the temporary paths. Please avoid global environment mutation by injecting the history/config path, or explicitly serialize these tests and centralize the setup/cleanup.
|
Thank you for the review feedback! I have refactored ests/history-profile.test.mjs to centralize and isolate all environment setup and teardown into the withTempHome helper. This ensures process-global environment variables (HOME, APPDATA, XDG_CONFIG_HOME) and temporary directories are cleanly restored and deleted in a inally block for all tests, eliminating duplicate setup boilerplate and avoiding race conditions. |
|
404-Page-Found
left a comment
There was a problem hiding this comment.
LGTM — clean test-only PR that adds meaningful coverage for buildProfile's scope/body rates and empty-history edge case, while reducing duplication with the withTempHome helper.



Closes #236. This adds unit tests covering the profile-building logic including scope-usage ratio, body-usage ratio, and the empty history edge case.
Summary by CodeRabbit