Skip to content

New unit-test builder generates incorrect coverage option for Windows #30698

Closed
@wein2011

Description

@wein2011

Command

build

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

The function generateCoverageOption in @angular/build/src/builders/unit-test/builder.js returns an object with the following property:

include: [`${node_path_1.default.relative(workspaceRoot, outputPath)/**`]

On Windows the function "relative" generates something like: dist\test-out\20250710T212123033Z-6ebf298b/**

This should probably be changed to something like:

include: [`${node_path_1.default.relative(workspaceRoot, outputPath).replaceAll(node_path_1.default.sep, node_path_1.default.posix.sep)}/**`]

to use the correct separators and to generate: dist/test-out/20250710T212123033Z-6ebf298b/**

Minimal Reproduction

You need to install version 20.1.0 and use the code coverage option

Exception or Error


Your Environment

Angular CLI: 20.1.0
Node: 22.16.0
Package Manager: npm 10.9.2
OS: win32 x64

Angular: 20.1.0
... animations, build, cdk, cli, common, compiler, compiler-cli
... core, forms, language-service, material
... material-date-fns-adapter, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.0
@angular-devkit/core         20.1.0
@angular-devkit/schematics   20.1.0
@schematics/angular          20.1.0
rxjs                         7.8.2
typescript                   5.8.3

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