Skip to content

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

Open
clydin wants to merge 3 commits intoangular:mainfrom
clydin:karma/coverage-optional
Open

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

Conversation

@clydin
Copy link
Copy Markdown
Member

@clydin clydin commented Apr 3, 2026

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
Copy link
Copy Markdown

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer 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.

1 participant