Skip to content

Commit

Permalink
fix(cli): improve error message on script timeout (#681)
Browse files Browse the repository at this point in the history
Co-authored-by: Gabe <41127686+Zidious@users.noreply.github.com>
Co-authored-by: Steven Lambert <2433219+straker@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 22, 2023
1 parent ada5d28 commit b407c6c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/cli/src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import axeTestUrls from '../lib/axe-test-urls';
import event from '../lib/events';
import { startDriver } from '../lib/webdriver';
import { error as selenium_error } from 'selenium-webdriver';

const cli = async (
args: OptionValues,
Expand Down Expand Up @@ -108,8 +109,19 @@ const cli = async (
rules,
disable
};
let outcome;
try {
const outcome = await axeTestUrls(urls, testPageConfigParams, events);
try {
outcome = await axeTestUrls(urls, testPageConfigParams, events);
} catch (e) {
if (e instanceof selenium_error.ScriptTimeoutError) {
console.error(error('Error: %s'), e.message);
console.log(`The timeout is currently configured to be ${timeout} seconds (you can change it with --timeout).`)
process.exit(2);
} else {
throw e;
}
}
if (silentMode) {
process.stdout.write(JSON.stringify(outcome, null, 2));
return;
Expand Down

0 comments on commit b407c6c

Please sign in to comment.