From ae50fb36c45dfdb81e0f801df6bd9795e1dc941b Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Mon, 4 Sep 2023 06:44:19 -0400 Subject: [PATCH] Stop extra semicolons in exclude paths from preventing results (#297) --- features/exclude-paths-from-report.feature | 5 +++++ src/argsParser.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/features/exclude-paths-from-report.feature b/features/exclude-paths-from-report.feature index 33492cb..045551e 100644 --- a/features/exclude-paths-from-report.feature +++ b/features/exclude-paths-from-report.feature @@ -16,3 +16,8 @@ Scenario: Ignore none Given file "exports.ts" is export const a = 1; When analyzing "tsconfig.json" with files ["--excludePathsFromReport=other-1;other-2"] Then the result is { "exports.ts": ["a"] } + +Scenario: Extra semi-colons doesn't filter all results + Given file "exports.ts" is export const a = 1; + When analyzing "tsconfig.json" with files ["--excludePathsFromReport=other-1;;other-2;"] + Then the result is { "exports.ts": ["a"] } \ No newline at end of file diff --git a/src/argsParser.ts b/src/argsParser.ts index 00e302d..ee4ccab 100644 --- a/src/argsParser.ts +++ b/src/argsParser.ts @@ -43,7 +43,9 @@ function processOptions( { const paths = optionValue.split(';'); paths.forEach((path) => { - pathsToExcludeFromReport.push(path); + if (path) { + pathsToExcludeFromReport.push(path); + } }); } break;