refactor(@angular/build): use standalone Instrumenter API for code coverage#33571
Open
clydin wants to merge 1 commit into
Open
refactor(@angular/build): use standalone Instrumenter API for code coverage#33571clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors code coverage instrumentation by removing the custom Babel plugin and instead using istanbul-lib-instrument's createInstrumenter directly in javascript-transformer-worker.ts before Babel transformations. The review feedback highlights a critical issue where the input source map is not passed to instrumentSync, which breaks source-mapped code coverage reports, and provides a code suggestion to extract and pass the inline source map.
…verage This refactors the code coverage instrumentation in the esbuild pipeline to bypass Babel and use the standalone `Instrumenter` API from `istanbul-lib-instrument` directly. The instrumenter is only used by the Karma/Jasmine testing implementation. Since first-party code coverage instrumentation and third-party Angular linking are almost always mutually exclusive for any given file, we do not benefit from composing them into a single Babel pass. Using the high-level standalone API simplifies the transformer worker and allows us to completely remove the custom `add-code-coverage.ts` Babel plugin.
609c25d to
7d5d0cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This refactors the code coverage instrumentation in the esbuild pipeline to bypass Babel and use the standalone
InstrumenterAPI fromistanbul-lib-instrumentdirectly. The instrumenter is only used by the Karma/Jasmine testing implementation.Since first-party code coverage instrumentation and third-party Angular linking are almost always mutually exclusive for any given file, we do not benefit from composing them into a single Babel pass. Using the high-level standalone API simplifies the transformer worker and allows us to completely remove the custom
add-code-coverage.tsBabel plugin.