1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-30 09:10:42 +02:00
Files
flexsearch/test/misc/reporter.js
2025-03-22 15:42:12 +01:00

21 lines
656 B
JavaScript

const libCoverage = require('istanbul-lib-coverage');
const { createReporter } = require('istanbul-api');
const coverage_1 = require('./.nyc_output/coverage.json');
const coverage_2 = require('./.nyc_output/coverage2.json');
const normalizeJestCoverage = (obj) => {
const result = obj;
Object.entries(result).forEach(([k, v]) => {
if (v.data) result[k] = v.data;
});
return result;
};
const map = libCoverage.createCoverageMap();
map.merge(normalizeJestCoverage(coverage_1));
map.merge(normalizeJestCoverage(coverage_2));
const reporter = createReporter();
reporter.addAll(['html', 'json', 'lcov', 'text']);
reporter.write(map);