Files
react-native-devtools-frontend/scripts/test/merge_coverage_reports.js
T
Tim van der Lippe baa6dec654 Add script to merge unit and interaction test coverage
This script can be invoked to obtain the coverage from the unit
and interaction tests and writes them to a coverage-summary.json
file that lives in `test/`. This file can then be used in favor of
karma-coverage/coverage-summary.json to upload to the Chromium
infrastructure.

As a follow-up, we should turn on coverage collection on CQ and
hook up this script after both unit and interaction tests have
completed.

R=jacktfranklin@chromium.org
CC=liviurau@chromium.org

Bug: 1206705
Change-Id: I52199940d6747ec13f208233e04dcf81a618a8fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2884240
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-11 09:19:48 +00:00

20 lines
724 B
JavaScript

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const path = require('path');
const {createCoverageMap} = require('istanbul-lib-coverage');
const report = require('istanbul-lib-report');
const reports = require('istanbul-reports');
const mergedMap = createCoverageMap(require(path.join('..', '..', 'karma-coverage', 'coverage-final.json')));
mergedMap.merge(require(path.join('..', '..', 'interactions-coverage', 'coverage-final.json')));
const context = report.createContext({
dir: 'test',
coverageMap: mergedMap,
defaultSummarizer: 'nested',
});
reports.create('json-summary').execute(context);