Karma builder ignores assets directory with "builderMode: application" #28754
Labels
area: @angular-devkit/build-angular
devkit/build-angular:karma
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
The karma builder has an option to define a assets directories.
By default, it uses:
{"glob": "**/*", "input": "public" }
.When using
"builderMode: application"
, this option is ignored and the Karma server throws 404 for the assets used in tested components.Minimal Reproduction
Generate a new project with
npx @angular/cli@19.0.0-rc.0 new karma-assets --defaults --no-routing
.Add
"builderMode": "application",
to angular.json in the karma options.Rename
public/favicon.ico
topublic/favicon.png
.Replace the
app.component.html
template with<img src="favicon.png" alt="Angular Logo" />
.Replace the
app.component.spec.ts
with:Launch
ng test
Exception or Error
31 10 2024 07:20:02.816:WARN [karma]: No captured browser, open http://localhost:9876/
31 10 2024 07:20:02.825:INFO [karma-server]: Karma v6.4.4 server started at http://localhost:9876/
31 10 2024 07:20:02.825:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
31 10 2024 07:20:02.827:INFO [launcher]: Starting browser ChromeHeadless
31 10 2024 07:20:03.544:INFO [Chrome Headless 130.0.0.0 (Mac OS 10.15.7)]: Connected on socket V7qJDTy8680sTot9AAAB with id 30066879
31 10 2024 07:20:03.699:WARN [web-server]: 404: /favicon.png
Your Environment
Angular CLI: 19.0.0-rc.0
Node: 20.13.1
Package Manager: npm 9.7.1
OS: darwin arm64
Angular: 19.0.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.1900.0-rc.0
@angular-devkit/build-angular 19.0.0-rc.0
@angular-devkit/core 19.0.0-rc.0
@angular-devkit/schematics 19.0.0-rc.0
@schematics/angular 19.0.0-rc.0
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: