Skip to content

Karma builder can't handle multiple spec files with same name with "builderMode: application" #28756

@cexbrayat

Description

@cexbrayat

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

This issue is similar to #26810

When a project has several spec files with the same name, the esbuilder outputs them to the same location and crashes.

Minimal Reproduction

Generate a new project with npx @angular/cli@19.0.0-rc.0 new karma-collision --defaults --no-routing.
Add "builderMode": "application", to angular.json in the karma options.
Add a new component with ng g c other/app
Run ng test

Exception or Error

An unhandled exception occurred: /Users/cedric/Code/temp/karma-collision/src/app/app.component.spec.ts and /Users/cedric/Code/temp/karma-collision/src/app/other/app/app.component.spec.ts both output to the same location app.component.spec. Rename or move one of the files to fix the conflict.
See "/private/var/folders/fl/sx8_jbfd1gg3gg04jb0lr_n00000gn/T/ng-m92j7I/angular-errors.log" for further details.

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

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions