Files
react-native-devtools-frontend/scripts/test/merge_coverage_reports.js
T
Andrés Olivares 10417e7ccb Export merged results of unit and interaction test coverage as text file
For convenience, since the bots will still use the JSON file.

Also, an option to define the folders on which coverage will be
calculated is added to the interaction tests. The flag works
identically to the COVERAGE_FOLDERS of unit tests, i.e. a pattern is
provided to define the included folders. For example: the flag can be
set like COVERAGE_FOLDERS=
front_end/{models/trace,models/timeline_model,panels/timeline}

These two changes should help to calculate the total OPP coverage in
go/opp-test-coverage

Bug: 1424729
Change-Id: Ie982f62dfac0014c05075e53173a8e7710d3b9e0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4345493
Commit-Queue: Andres Olivares <andoli@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2023-03-20 09:39:59 +00:00

21 lines
789 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);
reports.create('text', {file: 'coverage.txt'}).execute(context);