Skip to content

fix(bundlecheck): Make bars equal when formatted sizes match - #479

Merged
aversini merged 1 commit into
mainfrom
fix(bundlecheck)-Make-bars-equal-when-formatted-sizes-match
Jan 31, 2026
Merged

aversini merged 1 commit into
mainfrom
fix(bundlecheck)-Make-bars-equal-when-formatted-sizes-match

Conversation

@aversini

Copy link
Copy Markdown
Collaborator

Detect when all displayed (formatted) gzip/raw sizes are identical and treat them as equal for bar calculation. Update calcBarLength to accept an allSame flag and return the full barWidth when values are effectively the same to avoid misleading visual differences for values that format to the same string. Add tests to verify equal bar lengths for values that format identically and differing bar lengths when formatted values differ.

Detect when all displayed (formatted) gzip/raw sizes are identical and treat them as equal for bar calculation. Update calcBarLength to accept an allSame flag and return the full barWidth when values are effectively the same to avoid misleading visual differences for values that format to the same string. Add tests to verify equal bar lengths for values that format identically and differing bar lengths when formatted values differ.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the bundle size trend graph so that bar lengths better reflect the human-readable size labels and avoid misleading visual differences for values that format identically. It does this by detecting when the formatted gzip/raw sizes are all the same and treating them as equal for bar-scaling, with accompanying tests to lock in the behavior.

Changes:

  • Update renderTrendGraph to compute whether all formatted gzip/raw sizes are identical and pass an allSame flag into the bar-length calculation.
  • Extend the internal calcBarLength helper to accept the allSame flag and return the full bar width when values are effectively equal in their formatted representation.
  • Add targeted tests verifying equal bar lengths when formatted values match and differing bar lengths when formatted values differ, alongside existing min-max scaling tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/bundlecheck/src/trend.ts Adds formatted-size equality checks and updates bar-length calculation to use an allSame flag so all visually-equal sizes render with full-width bars.
packages/bundlecheck/src/__tests__/trend.test.ts Adds tests covering the new equal-bar behavior for identically formatted values and ensuring bars differ when formatted values differ, preserving existing min-max scaling expectations.

@aversini
aversini merged commit 200d43e into main Jan 31, 2026
12 checks passed
@aversini
aversini deleted the fix(bundlecheck)-Make-bars-equal-when-formatted-sizes-match branch January 31, 2026 13:36
@aversini aversini mentioned this pull request Jan 31, 2026
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.

2 participants