Skip to content

feat(@angular/build): move istanbul-lib-instrument to optional peer dependency - #32935

Merged
clydin merged 3 commits into
angular:mainfrom
clydin:karma/coverage-optional
Apr 7, 2026
Merged

feat(@angular/build): move istanbul-lib-instrument to optional peer dependency#32935
clydin merged 3 commits into
angular:mainfrom
clydin:karma/coverage-optional

Conversation

@clydin

@clydin clydin commented Apr 3, 2026

Copy link
Copy Markdown
Member

Move istanbul-lib-instrument from dependencies to optional peer dependencies. This helps reduce the transitive dependency count for new projects.

BREAKING CHANGE: istanbul-lib-instrument is now an optional peer dependency.
Projects using karma with code coverage enabled will need to ensure that istanbul-lib-instrument is installed. Note: ng update will automatically add this dependency during the update process.

@clydin clydin added the target: major This PR is targeted for the next major release label Apr 3, 2026
@angular-robot angular-robot Bot added detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit area: @angular/build area: @schematics/angular labels Apr 3, 2026
@clydin
clydin force-pushed the karma/coverage-optional branch 4 times, most recently from eda39ae to 9353d53 Compare April 3, 2026 14:37
…library generator dependencies

Update addTestRunnerDependencies to include istanbul-lib-instrument when generating new applications or libraries with the Karma test runner.
@clydin
clydin force-pushed the karma/coverage-optional branch 6 times, most recently from 9c6bc65 to 07f6b50 Compare April 3, 2026 17:50
@clydin
clydin marked this pull request as ready for review April 3, 2026 18:03

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request transitions istanbul-lib-instrument to an optional dependency and implements dynamic loading within the JavaScript transformer worker. It includes a new migration schematic to automatically add the package to projects utilizing Karma for code coverage. Feedback suggests improving the error handling when the package is missing by providing more specific instructions to the user on how to resolve the issue.

clydin added 2 commits April 3, 2026 14:35
…ependency

Move `istanbul-lib-instrument` from dependencies to optional peer dependencies. This helps reduce the transitive dependency count for new projects.

BREAKING CHANGE: `istanbul-lib-instrument` is now an optional peer dependency.
Projects using karma with code coverage enabled will need to ensure that istanbul-lib-instrument is installed. Note: `ng update` will automatically add this dependency during the update process.
Add a new schematic migration to automatically add istanbul-lib-instrument to devDependencies for projects that use Karma.

Covered builders:
- @angular-devkit/build-angular:karma
- @angular/build:karma
- @angular/build:unit-test (when runner is 'karma')
@clydin
clydin force-pushed the karma/coverage-optional branch from 07f6b50 to ae952c4 Compare April 3, 2026 18:35
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Apr 3, 2026
@alan-agius4 alan-agius4 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 Apr 7, 2026
@clydin
clydin merged commit 4350506 into angular:main Apr 7, 2026
37 checks passed
@clydin

clydin commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

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

@angular-automatic-lock-bot

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.

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

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build area: @schematics/angular detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants