JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 118190
  • Score
    100M100P100Q178111F
  • License MIT

Merges multiple lcov results into one

Package Exports

  • lcov-result-merger
  • lcov-result-merger/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lcov-result-merger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

LCOV Result Merger

npm version CI Coverage Status code style: prettier semantic-release

When you have multiple test suites for the same application you still want to have the code coverage across all test suites.

This tool will handle this for you.

See the Migration Notes below if you are looking to upgrade between major versions.

Usage

./node_modules/.bin/lcov-result-merger 'FILE_PATTERN' ['OUTPUT_FILE']

Examples

Use stdout

  1. Generate LCOV Code Coverage into different files, e.g. build/coverage/coverage_X.log
  2. Run ./node_modules/.bin/lcov-result-merger 'build/coverage/coverage_*.log'
  3. Use the stdout to pipe it to e.g. Coveralls
  4. Done.

Use merged output file

  1. Generate LCOV Code Coverage into different files, e.g. build/coverage/coverage_X.log
  2. Run ./node_modules/.bin/lcov-result-merger 'build/coverage/coverage_*.log' 'target/coverage/coverage_merged.log'
  3. Done. Enjoy your merged file.

Prepend source file paths

Modify source file paths to be relative to the working directory that the merge operation was run in. Useful in monorepos where each child package gathers its own metrics.

./node_modules/.bin/lcov-result-merger 'FILE_PATTERN' ['OUTPUT_FILE'] --prepend-source-files

Since coverage output is rarely written directly into the project root, use --prepend-path-fix to describe the relative path between the lcov file and the project root. The default simply points to one directory up, "..", which works well for common tools such as NYC that write to a /coverage directory.

./node_modules/.bin/lcov-result-merger 'FILE_PATTERN' ['OUTPUT_FILE'] --prepend-source-files --prepend-path-fix "../src"

Migrating Notes

Additional information about breaking changes.

Version 6

  • The --legacy-temp-file flag has been removed. This means that if your project is expecting an errant lcov.info file to be created in the PWD, then it will need to be updated to instead use the output file specified when running the command.

  • The internal usage of temp files has also been eliminated. This only effects project that are directly importing the mergeCoverageReportFiles or mergeCoverageReportFilesStream functions into their own code. Both of these methods now return the merged LCOV content directly, in the form of a string, instead of a path to the temporary file where that content could be read.