type-coverage-core
Advanced tools
Comparing version 2.2.0 to 2.3.0
import ts from 'typescript'; | ||
import { AnyInfo, LintOptions } from './interfaces'; | ||
import { AnyInfo, LintOptions, FileTypeCheckResult } from './interfaces'; | ||
/** | ||
@@ -11,2 +11,3 @@ * @public | ||
program: ts.Program; | ||
fileCounts: Map<string, Pick<FileTypeCheckResult, "correctCount" | "totalCount">>; | ||
}>; |
@@ -57,2 +57,3 @@ "use strict"; | ||
const anys = []; | ||
const fileCounts = new Map(); | ||
for (const { sourceFile, file, hash, cache } of sourceFileInfos) { | ||
@@ -63,2 +64,8 @@ if (cache) { | ||
anys.push(...cache.anys.map((a) => ({ file, ...a }))); | ||
if (lintOptions.fileCounts) { | ||
fileCounts.set(file, { | ||
correctCount: cache.correctCount, | ||
totalCount: cache.totalCount, | ||
}); | ||
} | ||
continue; | ||
@@ -88,2 +95,8 @@ } | ||
anys.push(...context.typeCheckResult.anys.map((a) => ({ file, ...a }))); | ||
if (lintOptions.fileCounts) { | ||
fileCounts.set(file, { | ||
correctCount: context.typeCheckResult.correctCount, | ||
totalCount: context.typeCheckResult.totalCount | ||
}); | ||
} | ||
if (lintOptions.enableCache) { | ||
@@ -108,3 +121,3 @@ const resultCache = typeCheckResult.cache[file]; | ||
} | ||
return { correctCount, totalCount, anys, program }; | ||
return { correctCount, totalCount, anys, program, fileCounts }; | ||
} | ||
@@ -119,3 +132,4 @@ exports.lint = lint; | ||
ignoreCatch: false, | ||
ignoreFiles: undefined | ||
ignoreFiles: undefined, | ||
fileCounts: false, | ||
}; |
@@ -26,2 +26,3 @@ import ts from 'typescript'; | ||
ignoreFiles?: string | string[]; | ||
fileCounts: boolean; | ||
} | ||
@@ -28,0 +29,0 @@ export interface FileContext { |
{ | ||
"name": "type-coverage-core", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "A library to check type coverage for typescript code", | ||
@@ -22,3 +22,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "bb02e64c1f349cbf94e1c8b1a5f20e89dd720c2b" | ||
"gitHead": "b7466ef897408557d91bbe2138f45efe7053c029" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61813
1285