From d22903d43aa6f7967cda2dafe8fbf83ff8f46032 Mon Sep 17 00:00:00 2001 From: JayKid Date: Fri, 17 Nov 2017 14:31:14 +0100 Subject: [PATCH] feat: add flag that enables supplying a list of rules to be skipped during the analysis * chore: upgrade axe/webdriverjs versions (#35) * chore: upgrade axe/webdriverjs versions axe-core 2.4.1 axe-webdriverjs 1.1.4 * feat: upgrade to axe-webdriverjs@1.1.5 * docs: Add changeling for 1.0.2 * chore: update changelog for 1.1.0 * chore: update changelog to match npm version * fix: package.json & .snyk to reduce vulnerabilities (#39) The following vulnerabilities are fixed with a Snyk patch: - https://snyk.io/vuln/npm:debug:20170905 Latest report for dequelabs/axe-cli: https://snyk.io/test/github/dequelabs/axe-cli * feat: add flag that enables supplying a list of rules to be skipped during the analysis It works in the same way adding a rule/tag does. * doc: add documentation for the new parameter available (--disable) + Also removed an extra "the" in the previous method docu --- index.js | 1 + lib/axe-test-urls.js | 3 +++ readme.MD | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 691caf7..636a3d8 100755 --- a/index.js +++ b/index.js @@ -16,6 +16,7 @@ program.version(version) .option('-e, --exclude ', 'CSS selector of included elements, comma separated', utils.splitList) .option('-r, --rules ', 'IDs of rules to run, comma separated', utils.splitList) .option('-t, --tags ', 'Tags of rules to run, comma separated', utils.splitList) +.option('-l, --disable ', 'IDs of rules to disable, comma separated', utils.splitList) .option('-b, --browser [browser-name]', 'Which browser to run (Webdriver required)') .option('-s, --save [filename]', 'Save the output as a JSON file. Filename is optional') .option('-d, --dir ', 'Output directory') diff --git a/lib/axe-test-urls.js b/lib/axe-test-urls.js index b0501cf..ae92f5e 100644 --- a/lib/axe-test-urls.js +++ b/lib/axe-test-urls.js @@ -67,6 +67,9 @@ function testPages(urls, config, events) { } else if (config.rules) { axe.withRules(config.rules) } + if (config.disable) { + axe.disableRules(config.disable) + } if (config.timer) { console.time('axe-core execution time'); } diff --git a/readme.MD b/readme.MD index c6d8120..fa6de6d 100644 --- a/readme.MD +++ b/readme.MD @@ -28,7 +28,7 @@ You can run multiple pages at once, simply add more URLs to the command. If you ## Running specific rules -You can use the `--rules` flag to set which rules you wish to run, or you can use the `--tags` to tell axe to run all rules that have that specific tag. For example: +You can use the `--rules` flag to set which rules you wish to run, or you can use `--tags` to tell axe to run all rules that have that specific tag. For example: axe www.deque.com --rules color-contrast,html-has-lang @@ -37,6 +37,12 @@ Or, to run all wcag2a rules: axe www.deque.com --tags wcag2a +In case you want to disable some rules, you can use `--disable` followed by a list of rules. These will be skipped when analyzing the site: + + axe www.deque.com --disable color-contrast + +This option can be combined with either `--tags` or `--rules`. + A list of rules and what tags they have is available at: https://dequeuniversity.com/rules/worldspace/2.0/. ## Saving the results