GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Vitest coverage branches false reports · Issue #31644 · angular/angular-cli

Vitest coverage branches false reports #31644

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
Vitest coverage branches false reports#31644
Copy link

Description

@LeonEck
LeonEck
opened on Oct 30, 2025
Issue body actions

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

With 21.0.0-next.10 vitest produces several false reports for the covered branches.

Minimal Reproduction

This can already be observed when creating a new project, installing @vitest/coverage-v8 and running ng test --no-watch --coverage:

Image

Here is a larger example that showcases several instances:

protected readonly title = signal('next-ten');

protected readonly someInput = input.required<string>();

constructor() {
  if (true) {
    console.log(this.title());
  }
}
Image

I also observed (so far only in a pipe) that implemented interfaces are not reported as covered:

@Pipe({
  name: 'myTransform',
})
export class MyTransformPipe implements PipeTransform {
  transform(value: string, ...args: unknown[]): unknown {
    return value.toUpperCase();
  }
}
describe('MyTransformPipe', () => {
  it('create an instance', () => {
    const pipe = new MyTransformPipe();
    expect(pipe).toBeTruthy();
    expect(pipe.transform('test')).toBe('TEST');
  });
});
Image

Some more context:

Setting aot to false results in almost all lines getting covered. Only the if (true) case still reports that the else path was not taken.
With aot=false, karma produces 100% coverage.
But with aot=true, karma only reports these findings:

Image Image

Exception or Error


Your Environment

Angular CLI       : 21.0.0-next.10
Angular           : 21.0.0-rc.0
Node.js           : 24.11.0
Package Manager   : npm 11.6.2
Operating System  : darwin arm64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package                   │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build            │ 21.0.0-next.10    │ ^21.0.0-next.10   │
│ @angular/cli              │ 21.0.0-next.10    │ ^21.0.0-next.10   │
│ @angular/common           │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ @angular/compiler         │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ @angular/compiler-cli     │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ @angular/core             │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ @angular/forms            │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ @angular/platform-browser │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ @angular/router           │ 21.0.0-rc.0       │ ^21.0.0-next.0    │
│ rxjs                      │ 7.8.2             │ ~7.8.0            │
│ typescript                │ 5.9.3             │ ~5.9.2            │
└───────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

No response

Activity

  1. alan-agius4
    closed this as a duplicateof Inaccurate code coverage with aot testing angular#64583 on Oct 30, 2025
  2. angular-automatic-lock-bot commented on Nov 30, 2025

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Nov 30, 2025
    More actions

    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.

  3. angular-automatic-lock-bot
    locked and limited conversation to collaborators on Nov 30, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.