angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

web-test-runner: handle multiple spec files with same name

Open cexbrayat opened this issue 2 years ago • 3 comments

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

cexbrayat avatar Jan 05 '24 21:01 cexbrayat

Getting the same issue in Angular 19 with Karma in "buildMode: application".

Klaster1 avatar Nov 20 '24 11:11 Klaster1

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).

hybrist avatar Nov 20 '24 12:11 hybrist

@jkrems got it: https://github.com/angular/angular-cli/issues/28915.

Klaster1 avatar Nov 21 '24 05:11 Klaster1

This experimental builder will be removed in version 22.

alan-agius4 avatar Oct 28 '25 19:10 alan-agius4

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.