Skip to content

@angular/builder:unit-test doesn't respect outputHashing option #31093

@th0r

Description

@th0r

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

A new vitest-based @angular/builder:unit-test builder doesn't respect outputHashing: "media" option. Because of this if the project contains assets with the same name it's not possible to run unit tests without making their names unique.

Minimal Reproduction

Clone the reproduction repo (https://github.com/th0r/ng-vitest-output-hashing-bug) and run npm i && npm run test. You'll see the following error:

[ERROR] Two output files share the same path but have different contents: media/bg.png [plugin angular-compiler]

It shouldn't happen as the test configuration uses the development build config which contains the "outputHashing": "media" option.

Exception or Error

[ERROR] Two output files share the same path but have different contents: media/bg.png [plugin angular-compiler]

Your Environment

Angular CLI: 20.2.0
Node: 22.16.0
Package Manager: npm 10.9.3
OS: darwin arm64


Angular: 20.2.1
... common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2002.0
@angular-devkit/core         20.2.0
@angular-devkit/schematics   20.2.0
@angular/build               20.2.0
@angular/cli                 20.2.0
@schematics/angular          20.2.0
rxjs                         7.8.2
typescript                   5.9.2
zone.js                      0.15.1

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