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 — fix(compiler-cli): ignore generated ngDevMode signal branch for code coverage by dgp1130 · Pull Request #67339 · angular/angular

Conversation

@dgp1130

@dgp1130 dgp1130 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

The Angular compiler unconditionally adds a debug name transform for signals which generates a conditional on ngDevMode (e.g., ngDevMode ? { debugName: "xyz" } : []). During testing, ngDevMode is true, so the true branch executes but the false branch is never executed. Consequently, coverage tools report the false branch as an untested line/branch, preventing 100% test coverage.

This commit adds a synthetic /* istanbul ignore next */ comment to the generated false branch so that Istanbul ignores it. We only include the istanbul comment (instead of additionally including c8) to focus on the established standard for Angular CLI/Karma coverage while maintaining compatibility with modern Vitest setups, since @vitest/coverage-v8 now natively respects the fallback istanbul comment.

In conversation with Gemini, I believe instanbul ignore next should be sufficient for Karma and Vitest with Istanbul or v8 code coverage, but I'm hoping either @alan-agius4 or @clydin can confirm whether or our code coverage story would benefit from a separate c8 ignore next directive.

Fixes #64583

/cc @hawkgs @AleksanderBodurri

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hawkgs reacted with thumbs up emoji mpalourdio reacted with heart emoji SkyZeroZx reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • ❤️ 1 reaction
  • 👀 1 reaction
@dgp1130
fix(compiler-cli): ignore generated ngDevMode signal branch for code …
2e53627
…coverage

The Angular compiler unconditionally adds a debug name transform for signals
which generates a conditional on `ngDevMode` (e.g., `ngDevMode ? { debugName: "xyz" } : []`).
During testing, `ngDevMode` is true, so the true branch executes but the
false branch is never executed. Consequently, coverage tools report the
false branch as an untested line/branch, preventing 100% test coverage.

This commit adds a synthetic `/* istanbul ignore next */` comment to the
generated false branch so that Istanbul ignores it. We only include the
istanbul comment (instead of additionally including c8) to focus on the
established standard for Angular CLI/Karma coverage while maintaining
compatibility with modern Vitest setups, since @vitest/coverage-v8 now
natively respects the fallback istanbul comment.

Fixes angular#64583
@dgp1130
dgp1130 requested a review from alan-agius4 February 26, 2026 21:27
@dgp1130 dgp1130 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release area: compiler Issues related to `ngc`, Angular's template compiler labels Feb 26, 2026
@ngbot ngbot Bot modified the milestone: Backlog Feb 26, 2026
@pullapprove
pullapprove Bot requested a review from JoostK February 26, 2026 21:28
@alan-agius4

alan-agius4 commented Feb 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

For vitest this is indeed enough as @vitest/coverage-v8 handles this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JoostK
JoostK approved these changes Feb 27, 2026
View reviewed changes
@mpalourdio mpalourdio mentioned this pull request Mar 1, 2026
From jest to vitest, the coverage seems wrong. mpalourdio/ng-http-loader#394
Closed
@dgp1130 dgp1130 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 4, 2026
@dgp1130
dgp1130 removed the request for review from alan-agius4 March 4, 2026 21:08
@atscott
atscott merged commit dc4cf64 into angular:main Mar 4, 2026
26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@atscott

atscott commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

  • main: dc4cf64
  • 21.2.x: 05d022d
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChrisMBarr ChrisMBarr mentioned this pull request Mar 9, 2026
Coverage reporter flagging parenthesis and TS type as uncovered branches vitest-dev/vitest#9811
Closed
6 tasks done
@dgp1130
dgp1130 deleted the signal-dev-coverage branch March 10, 2026 22:31
@SkyZeroZx SkyZeroZx mentioned this pull request Mar 24, 2026
V8 Coverage showing unexpected results angular/angular-cli#32836
Open
@angular-automatic-lock-bot

angular-automatic-lock-bot Bot commented Apr 10, 2026

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@JoostK JoostK JoostK approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Milestone

Backlog

Development

Successfully merging this pull request may close these issues.

Inaccurate code coverage with aot testing

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@dgp1130 @alan-agius4 @atscott @JoostK
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.