Skip to content

fix(@angular-devkit/build-angular): improve sourcemaps fidelity when code coverage is enabled #22016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2021
Merged

fix(@angular-devkit/build-angular): improve sourcemaps fidelity when code coverage is enabled #22016

merged 1 commit into from
Oct 27, 2021

Conversation

alan-agius4
Copy link
Collaborator

With this change we replace @jsdevtools/coverage-istanbul-loader webpack loader with babel-plugin-istanbul which is an official Babel plugin by the istanbuljs team.

Previously, when code coverage was enabled we had multiple Babel runs on the same file. This is because istanbuljs' instrumentSync and instrument APIs which are used by the Webpack plugin invokes Babel directly https://github.com/istanbuljs/istanbuljs/blob/66bc39b3c7b301a4b4456101a9996f90b1638dc0/packages/istanbul-lib-instrument/src/instrumenter.js#L98

By using the babel plugin directly, we avoid this which also improves the sourcemaps correctness and test performance.

Closes #22010

@google-cla google-cla bot added the cla: yes label Oct 26, 2021
@alan-agius4 alan-agius4 added the target: rc This PR is targeted for the next release-candidate label Oct 26, 2021
@alan-agius4 alan-agius4 requested a review from clydin October 26, 2021 09:39
@@ -240,16 +238,10 @@ export default custom<AngularCustomOptions>(() => {
// `@ampproject/remapping` source map objects but both are compatible with Webpack.
// This method for merging is used because it provides more accurate output
// and is faster while using less memory.
result.map = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No longer needed since there is a single babel pass!

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 26, 2021
@angular angular deleted a comment from ngbot bot Oct 26, 2021
@filipesilva
Copy link
Contributor

@alan-agius4 this PR has conflicts, can you resolve them please?

…code coverage is enabled

With this change we replace `@jsdevtools/coverage-istanbul-loader` webpack loader with [`babel-plugin-istanbul`](https://github.com/istanbuljs/babel-plugin-istanbul) which is an official Babel plugin by the istanbuljs team.

Previously, when code coverage was enabled we had multiple Babel runs on the same file. This is because istanbuljs' `instrumentSync` and `instrument` APIs which are used by the Webpack plugin invokes Babel directly https://github.com/istanbuljs/istanbuljs/blob/66bc39b3c7b301a4b4456101a9996f90b1638dc0/packages/istanbul-lib-instrument/src/instrumenter.js#L98

By using the babel plugin directly, we avoid this which also improves the sourcemaps correctness and test performance.

Closes #22010
@alan-agius4
Copy link
Collaborator Author

@filipesilva done.

@filipesilva
Copy link
Contributor

@alan-agius4 13.0.x still has merge conflicts, think you need separate PRs

@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release and removed target: rc This PR is targeted for the next release-candidate labels Oct 27, 2021
@alan-agius4
Copy link
Collaborator Author

@filipesilva open a separate pr for rc branch

@angular-automatic-lock-bot
Copy link

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 Nov 27, 2021
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 target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ng test] Can't debug tests when -code-coverage
3 participants