Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

lcov-result-merger

mweibel351.6kMIT5.0.1TypeScript support: included

Merges multiple lcov results into one

lcov, mocha, coveralls, code, coverage

readme

LCOV Result Merger

npm version Build Status Coverage Status js-standard-style semantic-release

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

This tool will handle this for you.

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"

changelog

5.0.0 (2023-11-20)

Features

5.0.0-rc.0 (2023-07-06)

⚠ BREAKING CHANGES

  • shift internals from Streams to Promises
  • use host system temp directory for transient lcov.info file

Features

  • use host system temp directory for transient lcov.info file (3c713f1)

Bug Fixes

  • subclass stream Transform since node 14 simplified construction does not offer "construct" (d9c14b6)

Code Refactoring

  • shift internals from Streams to Promises (0cbfa42)