angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Karma in application build mode throws "handle multiple spec files with same name" #28915

Open Klaster1 opened 1 day ago

Klaster1 commented 1 day ago

Command

test

Is this a regression?

The previous version in which this bug was not present was

18

Description

After setting "buildMode: application" for my Karma unit test setup, I am getting multiple "Two output files share the same path but have different contents" errors. The project contains five independent "data-source.spec.ts" suites, each a service for a different component. I suspect the "-2" suffix does not take this into account.

Suite paths:

Minimal Reproduction

  1. Have five unit test suites with the same file name located in different directories.
  2. Configure "buildMode: application".

Exception or Error

X [ERROR] Two output files share the same path but have different contents: data-source.spec.ts-2.js.map
X [ERROR] Two output files share the same path but have different contents: data-source.spec.ts-2.js
X [ERROR] Two output files share the same path but have different contents: data-source.spec.ts-2.js.map
X [ERROR] Two output files share the same path but have different contents: data-source.spec.ts-2.js
X [ERROR] Two output files share the same path but have different contents: data-source.spec.ts-2.js.map
X [ERROR] Two output files share the same path but have different contents: data-source.spec.ts-2.js

Your Environment

Angular CLI: 19.0.0
Node: 20.15.1
Package Manager: npm 10.7.0
OS: win32 x64

Angular: 19.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.0
@angular-devkit/build-angular   19.0.0
@angular-devkit/core            19.0.0 (cli-only)
@angular-devkit/schematics      19.0.0
@schematics/angular             19.0.0
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response