Skip to content

feat(coverage-istanbul): transform coverage using source map#821

Merged
9aoy merged 3 commits intomainfrom
coverage-sourcemap
Jan 8, 2026
Merged

feat(coverage-istanbul): transform coverage using source map#821
9aoy merged 3 commits intomainfrom
coverage-sourcemap

Conversation

@claneo
Copy link
Collaborator

@claneo claneo commented Dec 31, 2025

Summary

This PR extracts sourceMapUrl from js files and uses istanbul-lib-source-maps to map coverage back to the original source code.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Dec 31, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 4c9a2e6
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/695c84dd3400ef0008db7977
😎 Deploy Preview https://deploy-preview-821--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@claneo claneo force-pushed the coverage-sourcemap branch from 70bf803 to 6b85497 Compare January 6, 2026 02:22
@claneo claneo marked this pull request as ready for review January 6, 2026 03:33
Copilot AI review requested due to automatic review settings January 6, 2026 03:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds source map transformation support to the Istanbul coverage provider, enabling coverage reports to display results mapped back to the original TypeScript source files instead of the compiled JavaScript. The implementation uses istanbul-lib-source-maps to parse and apply source maps.

Key changes:

  • Added istanbul-lib-source-maps dependency and its type definitions
  • Implemented source map URL extraction from compiled JavaScript files using regex patterns
  • Created a caching mechanism to avoid redundant file reads for source map URLs
  • Integrated source map transformation into the coverage report generation pipeline

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pnpm-lock.yaml Added istanbul-lib-source-maps v5.0.6 and @types/istanbul-lib-source-maps v4.0.4 dependencies
packages/coverage-istanbul/package.json Updated dependencies list with new source map libraries (alphabetically sorted)
packages/coverage-istanbul/src/utils.ts Implemented getSourceMappingURL, registerSourceMapURL, and transformCoverage functions for source map handling
packages/coverage-istanbul/src/provider.ts Integrated source map URL registration and coverage transformation into the provider workflow
e2e/test-coverage/sourcemap.test.ts Added E2E test validating source map transformation from compiled JS back to original TS
e2e/test-coverage/fixtures/test/sourcemapMapping.test.ts Test fixture importing and testing compiled JavaScript with source maps
e2e/test-coverage/fixtures/src/sourcemap.ts Source TypeScript file for testing source map transformation
e2e/test-coverage/fixtures/rstest.sourcemap.config.ts Configuration file for source map E2E test
e2e/test-coverage/fixtures/rstest.*.config.ts Excluded new source map test from other coverage test configurations
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@9aoy
Copy link
Collaborator

9aoy commented Jan 8, 2026

👍

@9aoy 9aoy merged commit 6962c6c into main Jan 8, 2026
24 of 25 checks passed
@9aoy 9aoy deleted the coverage-sourcemap branch January 8, 2026 06:08
@9aoy 9aoy mentioned this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants