web-test-runner: handle multiple spec files with same name
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
When using the experimental web test runner builder, a project with several spec files with the same name (in differetn directories) can't run ng test
Minimal Reproduction
npx @angular/cli@next new wtr-same-name --defaults --no-routing
cd wtr-same-name
npm i --save-dev @web/test-runner
Replace the test runner in angular.jsonwith @angular-devkit/build-angular:web-test-runner
ng test --no-watch
ng g c other/app
ng test --no-watch
The second ng test fails as there are two spec files names app.component.spec.ts
Exception or Error
❯ ng test
NOTE: The Web Test Runner builder is currently EXPERIMENTAL and not ready for production use.
The 'assets' option is not yet supported by this builder.
The 'styles' option is not yet supported by this builder.
The 'inlineStyleLanguage' option is not yet supported by this builder.
The 'stylePreprocessorOptions' option is not yet supported by this builder.
The 'sourceMap' option is not yet supported by this builder.
The 'progress' option is not yet supported by this builder.
⠙ Building...
✘ [ERROR] Two output files share the same path but have different contents: app.component.spec.js.map
✘ [ERROR] Two output files share the same path but have different contents: app.component.spec.js
Your Environment
Angular CLI: 17.1.0-rc.0
Node: 18.19.0
Package Manager: npm 9.7.1
OS: darwin arm64
Angular: 17.1.0-next.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1701.0-rc.0
@angular-devkit/build-angular 17.1.0-rc.0
@angular-devkit/core 17.1.0-rc.0
@angular-devkit/schematics 17.1.0-rc.0
@angular/cli 17.1.0-rc.0
@schematics/angular 17.1.0-rc.0
rxjs 7.8.1
typescript 5.3.3
zone.js 0.14.2
Anything else relevant?
No response
Getting the same issue in Angular 19 with Karma in "buildMode: application".
Getting the same issue in Angular 19 with Karma in "buildMode: application".
Can you create a new issue with a reproduction for this? If this happens for Karma with application builder, that wouldn't be a known issue (unlike WTR).
@jkrems got it: https://github.com/angular/angular-cli/issues/28915.
This experimental builder will be removed in version 22.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.