Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// instrument without a filename
instrumenter.instrument(code, (error, code) => {
if (error) {
error.stack;
} else {
code.trim();
}
});
const cov = instrumenter.lastFileCoverage();
Object.create(cov);
const map = instrumenter.lastSourceMap();
Object.create(map);
const initialCov = readInitialCoverage(code);
initialCov.gcv;
programVisitor(babelTypes);
programVisitor(babelTypes, filename);
programVisitor(babelTypes, filename, { coverageVariable: 'coverage' });
const visitor = programVisitor(babelTypes, filename, { inputSourceMap: sourceMap });
visitor.enter(filename);
const data = visitor.exit(filename);
Object.create(data.fileCoverage);
instrumentSync (code, filename) {
const extracted = readInitialCoverage(code)
if (extracted) {
this.fileCoverage = extracted.coverageData
} else {
this.fileCoverage = null
}
return code
},
lastFileCoverage () {
jsFiles.forEach(file => {
const src = fs.readFileSync(file);
if (NodeTranspiler.shouldCompile(src)) {
const code = nodeTranspiler.transformWithCache(src, file);
const coverage = libInstrument.readInitialCoverage(code);
if (coverage != null && coverage.coverageData != null) {
result[file] = coverage.coverageData;
}
}
});