From 89d77e9f1ffeebe3bc3c7a22bd5e2b5831af1e58 Mon Sep 17 00:00:00 2001 From: Tetsuro Yoshikawa Date: Tue, 17 May 2022 00:10:03 +0900 Subject: [PATCH] fix: not working excludes option. --- src/index.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9b6e480..76aba42 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,11 +15,7 @@ const generateCommand = () => { .choices(['HTML', 'JSON', 'CSV']) .default('HTML') ) - .requiredOption( - '--excludes ', - 'exclude patterns is separated by a comma. example: .test.ts$,.spec.ts$', - '$^' - ) + .option('--excludes ', 'exclude patterns is separated by a comma. example: .test.ts$ .spec.ts$') .requiredOption('--matches ', 'match patterns. example: .ts$', '.*') .option( '-o, --outputReportPath ', @@ -32,7 +28,7 @@ Fo r HTML or CSV, specify the directory, and for JSON, specify the file.` const outputReportPath = options.outputReportPath ?? (options.outputFormat === 'JSON' ? null : './sabik_report'); const outputPath = outputReportPath !== null ? resolve(outputReportPath) : null; const analyzedTarget = resolve(targetPath ?? './'); - const excludes = (options.excludes).split(',').map((row) => new RegExp(row)); + const excludes = (options.excludes ?? ['$^']).map((row) => new RegExp(row)); const matches = new RegExp(options.matches); if (!fs.existsSync(analyzedTarget)) {