Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
runner.on('end', () => {
const mainReporter = istanbulAPI.createReporter();
const coverageMap = libCoverage.createCoverageMap();
const JSONPath = path.resolve(__dirname, '..', 'coverage', 'coverage-final.json');
const MainJSONPath = path.resolve(__dirname, '..', 'coverage', 'coverage-final-main.json');
const RendererJSONPath = path.resolve(__dirname, '..', 'coverage', 'coverage-final-renderer.json');
coverageMap.merge(global.__coverage__ || {});
mainReporter.addAll(['json']);
mainReporter.write(coverageMap, {});
// node_modules\.bin\remap-istanbul -i coverage\coverage-final.json -o coverage\coverage-final.json -t json
const JSONOutput = fs.readFileSync(JSONPath, 'utf8');
const JSONObjectString = JSONOutput.replace(/"(.+?\.js)": /gi, (all, match) => `"${match.replace(/\\/g, '\\\\')}": `);
const JSONObject = JSON.parse(JSONObjectString);
Object.keys(JSONObject).forEach((JSONKey) => {
if (/\/src\//g.test(JSONKey) || /\\src\\/g.test(JSONKey)) {
fnMap: {},
branchMap: {},
s: {},
f: {},
b: {}
};
const summary1 = createCoverageSummary(summaryData);
summary1.data;
summary1.branches;
summary1.lines;
summary1.functions;
summary1.statements;
const summary2 = createCoverageSummary(summary1);
const map1 = createCoverageMap(coverageMapData);
map1.data;
const map2 = createCoverageMap(map1);
map2.data;
const fileCoverage1 = createFileCoverage('path/to/foo');
fileCoverage1.data;
const fileCoverage2 = createFileCoverage(fileCoverage1.data);
fileCoverage2.data;
const fileCoverage3 = createFileCoverage(fileCoverageData);
fileCoverage3.data;
// CoverageSummary methods and properties
summary1.isEmpty();
summary1.toJSON();
summary1.merge(summary2);
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);
async function main() {
const coverageMap = istanbulCoverage.createCoverageMap( {} );
const reports = [ rootDir + '/e2e/coverage-final.json' ];
if ( false !== args.js ) {
reports.push( rootDir + '/js/coverage-final.json' );
}
if ( Array.isArray( reports ) ) {
mergeAllReports( coverageMap, reports );
generateReport( coverageMap, args.reporter || 'lcov' );
}
}
const libCoverage = require("istanbul-lib-coverage")
const { createReporter } = require("istanbul-api")
const fs = require("fs")
const path = require("path")
const normalizeJestCoverage = result => {
Object.entries(result).forEach(([k, v]) => {
if (v.data) result[k] = v.data
})
return result
}
const map = libCoverage.createCoverageMap()
const jestCoverage = require("../.nyc_output/coverage-final.json")
map.merge(normalizeJestCoverage(jestCoverage))
const reporter = createReporter()
reporter.addAll(["json"])
reporter.write(map)
fs.copyFile(
"./coverage/coverage-final.json",
"./.nyc_output/coverage-final.json",
error => error && console.log(error)
)
async remapCoverage (obj) {
const transformed = await this._sourceMapCache.transformCoverage(
libCoverage.createCoverageMap(obj)
)
return transformed.data
}
function run(formats, config, opts, callback) {
if (!callback && typeof opts === 'function') {
callback = opts;
opts = {};
}
opts = opts || {};
const coverageMap = libCoverage.createCoverageMap();
const includePattern = opts.include || '**/coverage*.raw.json';
const reporter = new Reporter(config);
if (!formats || formats.length === 0) {
formats = config.reporting.reports();
}
try {
reporter.addAll(formats);
} catch (ex) {
ex.inputError = true;
return callback(ex);
}
const root = opts.root || process.cwd();
filesFor(
{
combineCoverage (coverage) {
fixSourcePathes(coverage)
const previous = existsSync(nycFilename)
? JSON.parse(readFileSync(nycFilename))
: istanbul.createCoverageMap({})
const coverageMap = istanbul.createCoverageMap(previous)
coverageMap.merge(coverage)
saveCoverage(coverageMap)
debug('wrote coverage file %s', nycFilename)
return null
},
server.on('run_start', () => {
reportMap = require('istanbul-lib-coverage').createCoverageMap({});
});
server.on('coverage_complete', (browser, coverageReport) => {