feat: show a warning when significant size increase#1673
Conversation
When viewing a package, this shows a warning box making the user aware that the number of dependencies or the install size significantly increased. It sets the thresholds as: - Significant size increase = 25% - Significant dependency count increase = >5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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:
📝 WalkthroughWalkthroughAdds a new Vue 3 component Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
test/nuxt/composables/use-install-size-diff.spec.ts (1)
99-194: Add explicit boundary tests for threshold cut-offs.Please add exact-boundary assertions for
25%size increase and+5dependencies to lock in the intended>semantics.🧪 Suggested test additions
+ it('does not exceed size threshold at exactly 25%', async () => { + const pkg = createPackage({ '1.0.0': '2020-01-01', '1.1.0': '2021-01-01' }) + const current = createInstallSize({ version: '1.1.0', totalSize: 6250, dependencyCount: 3 }) + fetchSpy.mockResolvedValue( + createInstallSize({ version: '1.0.0', totalSize: 5000, dependencyCount: 3 }), + ) + + const { diff } = useInstallSizeDiff('pkg-size-boundary', '1.1.0', pkg, current) + await vi.waitFor(() => expect(fetchSpy).toHaveBeenCalled()) + expect(diff.value).toBeNull() + }) + + it('does not exceed dependency threshold at exactly +5 dependencies', async () => { + const pkg = createPackage({ '1.0.0': '2020-01-01', '1.1.0': '2021-01-01' }) + const current = createInstallSize({ version: '1.1.0', totalSize: 5000, dependencyCount: 8 }) + fetchSpy.mockResolvedValue( + createInstallSize({ version: '1.0.0', totalSize: 5000, dependencyCount: 3 }), + ) + + const { diff } = useInstallSizeDiff('pkg-dep-boundary', '1.1.0', pkg, current) + await vi.waitFor(() => expect(fetchSpy).toHaveBeenCalled()) + expect(diff.value).toBeNull() + })As per coding guidelines "
**/*.{test,spec}.{ts,tsx}: Write unit tests for core functionality usingvitest."
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
app/components/Package/SizeIncrease.vueapp/composables/useInstallSizeDiff.tsapp/pages/package/[[org]]/[name].vuei18n/locales/en.jsoni18n/schema.jsonlunaria/files/en-GB.jsonlunaria/files/en-US.jsonserver/utils/install-size.tsshared/types/index.tsshared/types/install-size.tstest/nuxt/composables/use-install-size-diff.spec.ts
💤 Files with no reviewable changes (1)
- server/utils/install-size.ts
|
Awesome, love this feature. Do you have a link to an example package where this can be seen in action? |
trueberryless
left a comment
There was a problem hiding this comment.
LGTM 🎉
Awesome new test cases as well, thank you!
When viewing a package, this shows a warning box making the user aware
that the number of dependencies or the install size significantly
increased.
It sets the thresholds as:
🔗 Linked issue
N/A