From 2dff9367e4289e7f8a6e798522e4d6f402777ccb Mon Sep 17 00:00:00 2001 From: Aldwin Vlasblom Date: Sun, 8 Sep 2019 13:05:18 +0200 Subject: [PATCH] Add a feature to allow users to pass files on the CLI --- cli.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli.mjs b/cli.mjs index 60deceb..a2ac250 100644 --- a/cli.mjs +++ b/cli.mjs @@ -4,7 +4,11 @@ import concise from './report-concise.mjs' import verbose from './report-verbose.mjs' import crawl from './crawler.mjs' -crawl('./test/') +const eventualFiles = process.argv.length > 2 + ? Promise.resolve(process.argv.slice(2)) + : crawl('./test/') + +eventualFiles .then(files => run(files, process.env.CI ? verbose : concise)) .then(({ passed, failed }) => failed ? process.exit(1) : process.exit(0)) .catch(err => {