8000 fix(@angular/build): proxy karma request from `/` to `/base` by alan-agius4 · Pull Request #30632 · angular/angular-cli · GitHub
[go: up one dir, main page]

Skip to content

fix(@angular/build): proxy karma request from / to /base #30632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintai 8000 ners 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

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

alan-agius4
Copy link
Collaborator

This commit fixes an issue where Karma requests were not being correctly proxied, leading to 404 errors for assets and other files during test execution in Angular projects. The fix ensures that all Karma requests from the root (/) are correctly forwarded to the /base directory, where Karma serves the files.

Karma will always serve files from /base. This change aligns the testing environment with this fundamental behavior, resolving pathing issues and ensuring that tests can locate their dependencies reliably.

Closes #30627

This commit fixes an issue where Karma requests were not being correctly proxied, leading to 404 errors for assets and other files during test execution in Angular projects. The fix ensures that all Karma requests from the root (`/`) are correctly forwarded to the `/base` directory, where Karma serves the files.

Karma will always serve files from `/base`. This change aligns the testing environment with this fundamental behavior, resolving pathing issues and ensuring that tests can locate their dependencies reliably.

Closes angular#30627
@alan-agius4 alan-agius4 requested a review from jkrems July 1, 2025 09:42
@alan-agius4 alan-agius4 marked this pull request as ready for review July 1, 2025 09:42
@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 labels Jul 1, 2025
@@ -99,13 +99,17 @@ function getBuiltInKarmaConfig(
// Any changes to the config here need to be synced to: packages/schematics/angular/config/files/karma.conf.js.template
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this apply? Do we need to sync this?

Copy link
Collaborator Author
@alan-agius4 alan-agius4 Jul 1, 2025

Choose a reason for hiding this comment

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

No, as the build-angular package uses it’s how karma .html files, where the base href is hardcoded

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jul 1, 2025
@alan-agius4 alan-agius4 merged commit 73f57f3 into angular:main Jul 1, 2025
35 checks passed
@alan-agius4 alan-agius4 deleted the karma-base-url branch July 1, 2025 13:02
@alan-agius4
Copy link
Collaborator Author

The changes were merged into the following branches: main, 20.0.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release
Projects
None yet
41F8
Development

Successfully merging this pull request may close these issues.

Scripts are not loaded properly in v20
2 participants
0