From 2fb7bece4267d3c83d796ccfd4dd39569c1ff733 Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Wed, 22 Nov 2023 17:13:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Skip=20empty=20url=20lines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/run.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/run.ts b/src/commands/run.ts index 78b0c52..feb73cd 100644 --- a/src/commands/run.ts +++ b/src/commands/run.ts @@ -56,6 +56,7 @@ export default async function (options: CommandOption): Promise { const urls: string[] = fs .readFileSync(filePath /*, { encoding: config.encoding }*/) .toString() + .trim() .replace(/\r?\n/g, ',') .split(','); @@ -71,7 +72,12 @@ export default async function (options: CommandOption): Promise { let outputText: string = raw ? '' : REPORT_HEADER.join(); const rawAxeResults: RawAxeResults = {}; for (let i = 0; i < urls.length; i++) { - const url: string = urls[i]; + const url: string = urls[i].trim(); + + if (!url) { + continue; + } + const page: puppeteer.Page = await browser.newPage(); await page.setBypassCSP(true); /* Emulate device: left here as a potential option for the future