Skip to content

Implement include option to track coverage of project-resolvable library packages#6

Merged
NullVoxPopuli merged 2 commits into
implementationfrom
copilot/sub-pr-1-one-more-time
Mar 15, 2026
Merged

Implement include option to track coverage of project-resolvable library packages#6
NullVoxPopuli merged 2 commits into
implementationfrom
copilot/sub-pr-1-one-more-time

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

The include: [] middleware option was documented but never implemented — node_modules were always filtered out unconditionally.

Changes

  • src/v8/report.js

    • resolveIncludedPaths(include, cwd): resolves each package name via import.meta.resolve(name, cwdUrl) anchored to process.cwd(), so only packages resolvable from the project root qualify (no transitive/non-hoisted deps). Extracts the node_modules/<pkg>/ directory from the resolved path; handles both my-pkg and @scope/pkg.
    • syntheticUncoveredMethods: accepts includedPaths; isLocalSource now returns true for source-map paths matching any included package's node_modules/<pkg>/ segment (works for both absolute and relative source-map sources).
    • generateReport: resolves options.include via resolveIncludedPaths and threads includedPaths through both syntheticUncoveredMethods and the final Istanbul coverage map filter.
  • src/testem/middleware.js: extracts include from options and forwards it to generateReport.

Usage

// testem.cjs
require("testem-code-coverage").middleware({
  include: ["my-v2-addon", "@scope/some-lib"],
});

Packages not resolvable from the project root are skipped with a warning rather than throwing.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…ct root

Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on library name specification with import.meta.resolve Implement include option to track coverage of project-resolvable library packages Mar 14, 2026
Copilot AI requested a review from NullVoxPopuli March 14, 2026 18:54
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review March 15, 2026 19:15
@NullVoxPopuli NullVoxPopuli merged commit 56eb1c6 into implementation Mar 15, 2026
2 of 3 checks passed
@NullVoxPopuli NullVoxPopuli deleted the copilot/sub-pr-1-one-more-time branch March 15, 2026 19:15
@github-actions github-actions Bot mentioned this pull request Mar 16, 2026
@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants