Socket
Socket
Sign inDemoInstall

type-coverage

Package Overview
Dependencies
27
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.25.0 to 2.27.0

62

dist/index.js

@@ -10,2 +10,6 @@ "use strict";

let suppressError = false;
let jsonOutput = false;
const output = {
succeeded: false,
};
const existsAsync = util.promisify(fs.exists);

@@ -45,2 +49,4 @@ const readFileAsync = util.promisify(fs.readFile);

--cache-directory string? set cache directory
--not-only-in-cwd boolean? include results outside current working directory
--json-output boolean? output results as JSON
`);

@@ -59,3 +65,3 @@ }

}
const { atLeast, debug, detail, enableCache, ignoreCatch, ignoreFiles, ignoreUnread, is, project, strict, update, updateIfHigher, ignoreNested, ignoreAsAssertion, ignoreTypeAssertion, ignoreNonNullAssertion, ignoreObject, ignoreEmptyType, showRelativePath, historyFile, noDetailWhenFailed, reportSemanticError, cacheDirectory, } = await getTarget(argv);
const { atLeast, debug, detail, enableCache, ignoreCatch, ignoreFiles, ignoreUnread, is, project, strict, update, updateIfHigher, ignoreNested, ignoreAsAssertion, ignoreTypeAssertion, ignoreNonNullAssertion, ignoreObject, ignoreEmptyType, showRelativePath, historyFile, noDetailWhenFailed, reportSemanticError, cacheDirectory, notOnlyInCWD, } = await getTarget(argv);
const { correctCount, totalCount, anys } = await (0, type_coverage_core_1.lint)(project, {

@@ -76,2 +82,3 @@ debug,

cacheDirectory,
notOnlyInCWD,
files: argv['--'].length > 0 ? argv['--'] : undefined,

@@ -83,9 +90,22 @@ });

if (detail || (!noDetailWhenFailed && (atLeastFailed || isFailed))) {
output.details = [];
for (const { file, line, character, text } of anys) {
const filePath = showRelativePath ? file : path.resolve(process.cwd(), file);
console.log(`${filePath}:${line + 1}:${character + 1}: ${text}`);
output.details.push({
character,
filePath,
line,
text
});
}
}
const percentString = percent.toFixed(2);
console.log(`${correctCount} / ${totalCount} ${percentString}%`);
output.atLeast = atLeast;
output.atLeastFailed = atLeastFailed;
output.correctCount = correctCount;
output.is = is;
output.isFailed = isFailed;
output.percent = percent;
output.percentString = percentString;
output.totalCount = totalCount;
if (update) {

@@ -131,2 +151,3 @@ await saveTarget(+percentString);

suppressError = getArgOrCfgVal(['suppressError']) || false;
jsonOutput = getArgOrCfgVal(['json-output', 'jsonOutput']) || false;
const atLeast = getArgOrCfgVal(['at-least', 'atLeast']);

@@ -155,2 +176,3 @@ const debug = getArgOrCfgVal(['debug']);

const cacheDirectory = getArgOrCfgVal(['cache-directory', 'cacheDirectory']);
const notOnlyInCWD = getArgOrCfgVal(['not-only-in-cwd', 'notOnlyInCWD']);
return {

@@ -180,2 +202,3 @@ atLeast,

cacheDirectory,
notOnlyInCWD,
};

@@ -188,3 +211,3 @@ }

if (currentPackageJson.typeCoverage) {
if (currentPackageJson.typeCoverage.atLeast) {
if (currentPackageJson.typeCoverage.atLeast != null) {
if (!ifHigher || target > currentPackageJson.typeCoverage.atLeast) {

@@ -194,3 +217,3 @@ currentPackageJson.typeCoverage.atLeast = target;

}
else if (currentPackageJson.typeCoverage.is) {
else if (currentPackageJson.typeCoverage.is != null) {
if (!ifHigher || target > currentPackageJson.typeCoverage.is) {

@@ -221,11 +244,34 @@ currentPackageJson.typeCoverage.is = target;

}
function printOutput(output, asJson) {
if (asJson) {
console.log(JSON.stringify(output, null, 2));
return;
}
const { details, correctCount, error, totalCount, percentString, succeeded } = output;
for (const detail of details || []) {
const { filePath, line, character, text } = detail;
console.log(`${filePath}:${line + 1}:${character + 1}: ${text}`);
}
if (percentString) {
console.log(`${correctCount} / ${totalCount} ${percentString}%`);
}
if (succeeded) {
console.log('type-coverage success.');
}
else {
console.log(error);
}
}
executeCommandLine().then(() => {
console.log('type-coverage success.');
output.succeeded = true;
printOutput(output, jsonOutput);
}, (error) => {
output.succeeded = false;
if (error instanceof Error) {
console.log(error.message);
output.error = error.message;
}
else {
console.log(error);
output.error = error;
}
printOutput(output, jsonOutput);
if (!suppressError) {

@@ -232,0 +278,0 @@ process.exit(1);

4

package.json
{
"name": "type-coverage",
"version": "2.25.0",
"version": "2.27.0",
"description": "A CLI tool to check type coverage for typescript code",

@@ -10,3 +10,3 @@ "repository": "https://github.com/plantain-00/type-coverage.git",

"minimist": "1",
"type-coverage-core": "^2.25.0"
"type-coverage-core": "^2.26.3"
},

@@ -13,0 +13,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc