type-coverage
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -13,2 +13,14 @@ "use strict"; | ||
} | ||
function statAsync(file) { | ||
return new Promise((resolve, reject) => { | ||
fs.stat(file, (error, stats) => { | ||
if (error) { | ||
reject(error); | ||
} | ||
else { | ||
resolve(stats); | ||
} | ||
}); | ||
}); | ||
} | ||
function globAsync(pattern, ignore) { | ||
@@ -64,3 +76,13 @@ return new Promise((resolve, reject) => { | ||
else if (include && Array.isArray(include) && include.length > 0) { | ||
rootNames = await globAsync(include.length === 1 ? include[0] : `{${include.join(",")}}`, exclude); | ||
const rules = []; | ||
for (const file of include) { | ||
const stats = await statAsync(file); | ||
if (stats.isDirectory()) { | ||
rules.push(`${file.endsWith("/") ? file.substring(0, file.length - 1) : file}/**/*.{ts,tsx}`); | ||
} | ||
else if (stats.isFile()) { | ||
rules.push(file); | ||
} | ||
} | ||
rootNames = await globAsync(rules.length === 1 ? rules[0] : `{${rules.join(",")}}`, exclude); | ||
} | ||
@@ -67,0 +89,0 @@ else { |
{ | ||
"name": "type-coverage", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A CLI tool to check type coverage for typescript code", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
51091
956