Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

type-coverage

Package Overview
Dependencies
Maintainers
1
Versions
136
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.3.2 to 1.4.0

2

dist/core.d.ts

@@ -1,2 +0,2 @@

export declare function lint(project: string, detail: boolean, debug: boolean): Promise<{
export declare function lint(project: string, detail: boolean, debug: boolean, files?: string[]): Promise<{
correctCount: number;

@@ -3,0 +3,0 @@ totalCount: number;

@@ -8,3 +8,3 @@ "use strict";

// tslint:disable-next-line:no-big-function
async function lint(project, detail, debug) {
async function lint(project, detail, debug, files) {
const { configFilePath, dirname } = tsconfig_1.getTsConfigFilePath(project);

@@ -882,3 +882,3 @@ const config = tsconfig_1.getTsConfig(configFilePath, dirname);

let file = sourceFile.fileName;
if (!file.includes('node_modules')) {
if (!file.includes('node_modules') && (!files || files.includes(file))) {
file = path.relative(process.cwd(), file);

@@ -885,0 +885,0 @@ sourceFile.forEachChild(node => {

@@ -24,7 +24,13 @@ "use strict";

}
const percent = Math.round(100 * correctCount / totalCount);
console.log(`${correctCount} / ${totalCount} ${percent}%`);
const atLeast = argv['at-least'];
const percent = Math.round(10000 * correctCount / totalCount) / 100;
console.log(`${correctCount} / ${totalCount} ${percent.toFixed(2)}%`);
let atLeast;
if (packageJson.typeCoverage && packageJson.typeCoverage.atLeast) {
atLeast = packageJson.typeCoverage.atLeast;
}
if (argv['at-least']) {
atLeast = argv['at-least'];
}
if (atLeast && percent < atLeast) {
throw new Error(`The type coverage rate(${percent}%) is lower than ${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.`);
}

@@ -31,0 +37,0 @@ }

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

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

},
"typeCoverage": {
"atLeast": 99
},
"bin": {

@@ -42,0 +45,0 @@ "type-coverage": "bin/type-coverage"

@@ -13,2 +13,3 @@ # type-coverage

[![Downloads](https://img.shields.io/npm/dm/type-coverage.svg)](https://www.npmjs.com/package/type-coverage)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fplantain-00%2Ftype-coverage%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)

@@ -31,1 +32,17 @@ ## install

--debug | boolean? | show debug info
## config in package.json
```json
"typeCoverage": {
"atLeast": 99 // same as --at-least
},
```
## add dynamic badges of type coverage
Use your own project url:
```md
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fplantain-00%2Ftype-coverage%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
```
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