coverage-istanbul
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -61,10 +61,27 @@ "use strict"; | ||
reporter.dir = (opts === null || opts === void 0 ? void 0 : opts.dir) || './coverage'; | ||
reporter.add('lcovonly'); | ||
reporter.addAll(['clover', 'cobertura', 'html']); | ||
reporter.addAll(['lcovonly', 'clover', 'cobertura', 'text-summary']); | ||
reporter.write(collector, sync, function () { | ||
// console.log('done'); | ||
resolve({ | ||
data: coverageInfo, | ||
reporterDir: reporter.dir, | ||
}); | ||
// 注意 ts 下设置 "esModuleInterop": true 之后使用 html 则会报错的, | ||
// 因此在这里保护一下,但还是没解决本质问题,待后续解决 | ||
const reporterForHtml = new istanbul_1.default.Reporter(); | ||
reporterForHtml.dir = reporter.dir; | ||
reporterForHtml.add('html'); | ||
try { | ||
reporterForHtml.write(collector, sync, function () { | ||
resolve({ | ||
data: coverageInfo, | ||
reporterDir: reporter.dir, | ||
}); | ||
}); | ||
} | ||
catch (err) { | ||
if (process.env.DEBUG_COVERAGE) { | ||
console.log('--reporterForHtml err--', err); | ||
} | ||
console.log('Try to write html for coverage reporter failed!', ((err === null || err === void 0 ? void 0 : err.message) || err)); | ||
resolve({ | ||
data: coverageInfo, | ||
reporterDir: reporter.dir, | ||
}); | ||
} | ||
}); | ||
@@ -75,5 +92,4 @@ }) | ||
}); | ||
// console.log(transformed) | ||
if (process.env.DEBUG) { | ||
console.log('--', typeof transformed); | ||
if (process.env.DEBUG_COVERAGE) { | ||
console.log('--typeof transformed--', typeof transformed); | ||
} | ||
@@ -80,0 +96,0 @@ }); |
{ | ||
"name": "coverage-istanbul", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "istanbul tools for test coverage", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -32,3 +32,3 @@ import fs from 'fs'; | ||
opts: ICreateE2ECoverageOpts | ||
):Promise<IE2ECoverageResult> { | ||
): Promise<IE2ECoverageResult> { | ||
return new Promise((resolve, reject) => { | ||
@@ -39,3 +39,3 @@ const collector = new istanbul.Collector(); | ||
// options is optional | ||
glob(globPattern, {}, function(err, files) { | ||
glob(globPattern, {}, function (err, files) { | ||
// console.log(files); | ||
@@ -80,10 +80,28 @@ if (err) { | ||
reporter.dir = opts?.dir || './coverage'; | ||
reporter.add('lcovonly'); | ||
reporter.addAll(['clover', 'cobertura', 'html']); | ||
reporter.write(collector, sync, function() { | ||
// console.log('done'); | ||
resolve({ | ||
data: coverageInfo, | ||
reporterDir: reporter.dir, | ||
}); | ||
reporter.addAll(['lcovonly', 'clover', 'cobertura', 'text-summary']); | ||
reporter.write(collector, sync, function () { | ||
// 注意 ts 下设置 "esModuleInterop": true 之后使用 html 则会报错的, | ||
// 因此在这里保护一下,但还是没解决本质问题,待后续解决 | ||
const reporterForHtml = new istanbul.Reporter(); | ||
reporterForHtml.dir = reporter.dir; | ||
reporterForHtml.add('html'); | ||
try { | ||
reporterForHtml.write(collector, sync, function () { | ||
resolve({ | ||
data: coverageInfo, | ||
reporterDir: reporter.dir, | ||
}); | ||
}); | ||
} catch (err) { | ||
if (process.env.DEBUG_COVERAGE) { | ||
console.log('--reporterForHtml err--', err); | ||
} | ||
console.log('Try to write html for coverage reporter failed!', (err?.message || err)); | ||
resolve({ | ||
data: coverageInfo, | ||
reporterDir: reporter.dir, | ||
}); | ||
} | ||
}); | ||
@@ -95,5 +113,4 @@ }) | ||
// console.log(transformed) | ||
if (process.env.DEBUG) { | ||
console.log('--', typeof transformed); | ||
if (process.env.DEBUG_COVERAGE) { | ||
console.log('--typeof transformed--', typeof transformed); | ||
} | ||
@@ -100,0 +117,0 @@ }); |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
178529
1608
0
3