Skip to content

@angular/build:unit-test: Launching ng test --include with Windows path fails #31428

@wein2011

Description

@wein2011

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

This issue is specific to Windows and launching ng test with a specific file. Vitest is configured as the test runner.

  1. Building tests works but running tests fails with the error: "No test files found." if you launch ng test with a Windows path:
ng test --browsers Chromium --include "C:\client\src\app\header\header.component.spec.ts"
  1. Building and running tests work if you launch ng test with a quasi-POSIX path on Windows:
ng test --browsers Chromium --include "C:/client/src/app/header/header.component.spec.ts"
  1. Building tests fails if you launch ng test with a full POSIX path on Windows:
ng test --browsers Chromium --include "/c/client/src/app/header/header.component.spec.ts"

Since the native Windows path is not working, you can't use ${file} in launch.json of Visual Studio Code. Similarly, the full POSIX path ${command:extension.commandvariable.file.filePosix}" is not working either. This prevents the launching of the current test file on Windows.

Minimal Reproduction

Reproduced with 21.0.0-next.7

Exception or Error


Your Environment

Angular CLI       : 21.0.0-next.7
Angular           : 21.0.0-next.7
Node.js           : 22.18.0
Package Manager   : npm 10.9.3
Operating System  : win32 x64

┌────────────────────────────────────┬───────────────────┬───────────────────┐
│ Package                            │ Installed Version │ Requested Version │
├────────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations                │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/build                     │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/cdk                       │ 21.0.0-next.8     │ ^21.0.0-next.7    │
│ @angular/cli                       │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/common                    │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/compiler                  │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/compiler-cli              │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/core                      │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/forms                     │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/language-service          │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/material                  │ 21.0.0-next.8     │ ^21.0.0-next.7    │
│ @angular/material-date-fns-adapter │ 21.0.0-next.8     │ ^21.0.0-next.7    │
│ @angular/platform-browser          │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/platform-browser-dynamic  │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ @angular/router                    │ 21.0.0-next.7     │ ^21.0.0-next.7    │
│ rxjs                               │ 7.8.2             │ ^7.8.2            │
│ typescript                         │ 5.9.3             │ ~5.9.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