Merge multiple NYC coverage files into one

Problem

Sending multiple coverage files to SeaLights might have a network cost and we will often prefer sending only one files. In order to do that, we will need to first merge all the NYC coverage files into one and then send it to SeaLights.

Solution

  1. Install the istanbul-merge package

    npm install istanbul-merge
  2. Make a string variable including all the files to merge

    json_files=$(find . ~+ -name "*.json" -print)
  3. Run the merge command

    istanbul-merge --out coverage.raw.json "$json_files"
  4. Upload the file to SeaLights