Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular-devkit/build-angular) : fix incorrect budget calculation #29234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

santoshyadavdev
Copy link
Contributor

Fixes #29040

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #29040

What is the new behavior?

It uses kb value from packages/angular/build/src/utils/bundle-calculator.ts so there is no difference in value when running tests

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@santoshyadavdev santoshyadavdev force-pushed the fix-incorect-budget-warning branch from 656defa to 3394f77 Compare December 28, 2024 17:11
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release merge: squash commits When the PR is merged, a squash and merge should be performed merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed and removed merge: squash commits When the PR is merged, a squash and merge should be performed merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed labels Jan 6, 2025

const failures = Array.from(checkBudgets(budgets, stats));

expect(failures.length).toBe(0);
Copy link
Collaborator

@alan-agius4 alan-agius4 Jan 6, 2025

Choose a reason for hiding this comment

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

Suggested change
expect(failures.length).toBe(0);
expect(failures).toHaveSize(0);

@@ -338,5 +336,38 @@ describe('bundle-calculator', () => {
message: jasmine.stringMatching('foo.ext exceeded maximum budget.'),
});
});

it('yields exceeded individual file budget - 29040', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not correct, as it does not yield exceeded

Suggested change
it('yields exceeded individual file budget - 29040', () => {
it('does not exceed the individual file budget limit', () => {

@@ -12,6 +12,8 @@ import { formatSize } from './format-bytes';
// Re-export to avoid direct schema importing throughout code
export { type BudgetEntry, BudgetType };

export const kB = 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
export const kB = 1000;
export const BYTES_IN_KILOBYTE = 1000;

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

Thanks for this just a couple of NITs.

The commit scope should be @angular/build and not @angular-devkit/build-angular and please add a commit message body. https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-commit-message-guidelines

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 6, 2025
@santoshyadavdev santoshyadavdev force-pushed the fix-incorect-budget-warning branch from 3394f77 to 27710bb Compare January 7, 2025 15:50
@angular-robot angular-robot bot requested a review from alan-agius4 January 7, 2025 15:50
@santoshyadavdev santoshyadavdev force-pushed the fix-incorect-budget-warning branch from 27710bb to 5f49618 Compare January 7, 2025 15:51
This PR makes change to kB value which was incorrect earlier

Fixes angular#29040
@santoshyadavdev santoshyadavdev force-pushed the fix-incorect-budget-warning branch from 5f49618 to ae19e25 Compare January 7, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews area: @angular/build target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Budget warnings calculated incorrectly with esbuild builder
2 participants