Skip to content

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

@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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions