Socket
Socket
Sign inDemoInstall

type-coverage

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-coverage - npm Package Compare versions

Comparing version 1.4.6 to 1.5.0

21

dist/index.js

@@ -25,8 +25,17 @@ "use strict";

suppressError = argv.suppressError;
const { correctCount, totalCount, anys } = await core_1.lint(argv.p || argv.project || '.', argv.detail, argv.debug);
for (const { file, line, character, text } of anys) {
console.log(`${path.resolve(process.cwd(), file)}:${line + 1}:${character + 1}: ${text}`);
const { correctCount, totalCount, anys } = await core_1.lint(argv.p || argv.project || '.', true, argv.debug);
const percent = Math.round(10000 * correctCount / totalCount) / 100;
const atLeast = await getAtLeast(argv);
const failed = atLeast && percent < atLeast;
if (argv.detail || failed) {
for (const { file, line, character, text } of anys) {
console.log(`${path.resolve(process.cwd(), file)}:${line + 1}:${character + 1}: ${text}`);
}
}
const percent = Math.round(10000 * correctCount / totalCount) / 100;
console.log(`${correctCount} / ${totalCount} ${percent.toFixed(2)}%`);
if (failed) {
throw new Error(`The type coverage rate(${percent.toFixed(2)}%) is lower than the target(${atLeast}%). \nYou can add '--detail' or use VSCode plugin to show detailed informations.`);
}
}
async function getAtLeast(argv) {
let atLeast;

@@ -43,5 +52,3 @@ const packageJsonPath = path.resolve(process.cwd(), 'package.json');

}
if (atLeast && percent < atLeast) {
throw new Error(`The type coverage rate(${percent.toFixed(2)}%) is lower than the target(${atLeast}%). \nYou can add '--detail' or use VSCode plugin to show detailed informations.`);
}
return atLeast;
}

@@ -48,0 +55,0 @@ executeCommandLine().then(() => {

{
"name": "type-coverage",
"version": "1.4.6",
"version": "1.5.0",
"description": "A CLI tool to check type coverage for typescript code",

@@ -5,0 +5,0 @@ "main": "dist/core.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc