Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
printDurations(zopf.testDurations, msg);
const libCoverage = require("istanbul-lib-coverage");
let map = libCoverage.createCoverageMap(global["__coverage__"]);
const libSourceMaps = require("istanbul-lib-source-maps");
const sourceMapCache = libSourceMaps.createSourceMapStore();
map = sourceMapCache.transformCoverage(map).map;
const libReport = require("istanbul-lib-report");
const context = libReport.createContext({ dir: "coverage" });
const reports = require("istanbul-reports");
const tree = libReport.summarizers.pkg(map);
// print text-lcov report to coverage.lcov file
tree.visit(reports.create("lcov"), context);
let finishedCoverageAt = Date.now();
console.log(
`coverage took ${(finishedCoverageAt - finishedAt).toFixed(2)}ms`
);
if (harness._exitCode === 0) {
console.log(chalk.green("[ OK ]"));
} else {
console.log(chalk.red("[FAIL]"));
}
resolve(harness._exitCode);
});
emitter: emitter
})
var remappedCoverageMap = sourceMapStore.transformCoverage(coverageMap).map
// If config.check is defined, check coverage levels for each browser
if (config.hasOwnProperty('check') && !checkedCoverage[browser.id]) {
checkedCoverage[browser.id] = true
var coverageFailed = checkCoverage(browser, remappedCoverageMap)
if (coverageFailed) {
if (results) {
results.exitCode = 1
}
}
}
var context = istanbulLibReport.createContext(options)
var tree = istanbulLibReport.summarizers.pkg(remappedCoverageMap)
var report = reports.create(reporterConfig.type || 'html', options)
// // If reporting to console or in-memory skip directory creation
var toDisk = !reporterConfig.type || !reporterConfig.type.match(/^(text|text-summary|in-memory)$/)
if (!toDisk && reporterConfig.file === undefined) {
tree.visit(report, context)
return
}
helper.mkdirIfNotExists(outputDir, function () {
log.debug('Writing coverage to %s', outputDir)
tree.visit(report, context)
})
})
statements: 0,
lines: 0,
branches: 0,
functions: 0,
excludes: [] // Currently list of files (root + path). For future, extend to patterns.
},
each: {
statements: 0,
lines: 0,
branches: 0,
functions: 0,
excludes: []
}
}
};
ret.reporting.watermarks = libReport.getDefaultWatermarks();
ret.reporting['report-config'] = {};
return ret;
}
// Instance variables
// ------------------
this.adapters = []
// Options
// -------
var config = rootConfig.coverageReporter || {}
var basePath = rootConfig.basePath
var reporters = config.reporters
var sourceMapStore = globalSourceMapStore.get(basePath)
var includeAllSources = config.includeAllSources === true
if (config.watermarks) {
config.watermarks = helper.merge({}, istanbulLibReport.getDefaultWatermarks(), config.watermarks)
}
if (!helper.isDefined(reporters)) {
reporters = [config]
}
var coverageMaps
function normalize (key) {
// Exclude keys will always be relative, but covObj keys can be absolute or relative
var excludeKey = isAbsolute(key) ? path.relative(basePath, key) : key
// Also normalize for files that start with `./`, etc.
excludeKey = path.normalize(excludeKey)
return excludeKey
}
statements: 0,
lines: 0,
branches: 0,
functions: 0,
excludes: [] // Currently list of files (root + path). For future, extend to patterns.
},
each: {
statements: 0,
lines: 0,
branches: 0,
functions: 0,
excludes: []
}
}
};
ret.reporting.watermarks = libReport.getDefaultWatermarks();
ret.reporting['report-config'] = {};
return ret;
}
export function createReport(): void {
const iLibCoverage = require('istanbul-lib-coverage');
const iLibSourceMaps = require('istanbul-lib-source-maps');
const iLibReport = require('istanbul-lib-report');
const iReports = require('istanbul-reports');
const global = new Function('return this')();
const mapStore = iLibSourceMaps.createSourceMapStore();
const coverageMap = iLibCoverage.createCoverageMap(global.__coverage__);
const transformed = mapStore.transformCoverage(coverageMap);
const tree = iLibReport.summarizers.flat(transformed.map);
const context = iLibReport.createContext({
dir: path.resolve(REPO_ROOT, `coverage`)
});
const reports = [iReports.create('lcov')];
reports.forEach(report => tree.visit(report, context));
}
generateCoverageReport() {
const coveragePath = dappPath(".embark", "coverage.json");
const coverageMap = JSON.parse(this.fs.readFileSync(coveragePath));
const map = coverage.createCoverageMap(coverageMap);
const tree = reporter.summarizers.nested(map);
const ctx = reporter.createContext({ dir: 'coverage' });
const report = reports.create('html', { skipEmpty: false, skipFull: false });
tree.visit(report, ctx);
}
generateCoverageReport() {
const coveragePath = dappPath(".embark", "coverage.json");
const coverageMap = JSON.parse(this.fs.readFileSync(coveragePath));
const map = coverage.createCoverageMap(coverageMap);
const tree = reporter.summarizers.nested(map);
const ctx = reporter.createContext({ dir: 'coverage' });
const report = reports.create('html', { skipEmpty: false, skipFull: false });
tree.visit(report, ctx);
}
export function createReport(): void {
const iLibCoverage = require('istanbul-lib-coverage');
const iLibSourceMaps = require('istanbul-lib-source-maps');
const iLibReport = require('istanbul-lib-report');
const iReports = require('istanbul-reports');
const global = new Function('return this')();
const mapStore = iLibSourceMaps.createSourceMapStore();
const coverageMap = iLibCoverage.createCoverageMap(global.__coverage__);
const transformed = mapStore.transformCoverage(coverageMap);
const tree = iLibReport.summarizers.flat(transformed.map);
const context = iLibReport.createContext({
dir: path.resolve(REPO_ROOT, `coverage`)
});
const reports = [iReports.create('lcov')];
reports.forEach(report => tree.visit(report, context));
}
report () {
var tree
var map = this.getCoverageMapFromAllCoverageFiles()
var context = libReport.createContext({
dir: this.reportDirectory(),
watermarks: this.config.watermarks
})
tree = libReport.summarizers.pkg(map)
this.reporter.forEach((_reporter) => {
tree.visit(reports.create(_reporter, {
skipEmpty: this.config.skipEmpty,
skipFull: this.config.skipFull
}), context)
})
if (this._showProcessTree) {
this.showProcessTree()
}