Skip to content

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

Closed

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

Activity

  1. added theissue type on Jul 11, 2025
  2. added 2 commits that reference this issue on Jul 11, 2025
    2f592ab
    0a655f3
  3. added a commit that references this issue on Jul 11, 2025
    558a0fe
  4. added a commit that references this issue on Jul 11, 2025
    cad1642
  5. added a commit that references this issue on Jul 15, 2025
    ebe7ab4
  6. angular-automatic-lock-bot commented on Aug 12, 2025

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    angular/build:unit-testarea: @angular/buildfreq1: lowseverity3: brokentype: bug/fix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions