pa11y / pa11y-ci

Pa11y CI is a CI-centric accessibility test runner, built using Pa11y
https://pa11y.org
GNU Lesser General Public License v3.0
519 stars 63 forks source link

option to run subset of urls from config file #246

Open kussmaul opened 1 month ago

kussmaul commented 1 month ago

I have a config file that contains ~40 urls, which I run as: pa11y-ci --config ./pa11y-ci.conf.js It would be useful (e.g., when debugging) to be able to run a subset of these urls. I tried: pa11y-ci --config ./pa11y-ci.conf.js http://localhost/path However, this appears to run the listed path(s) before the config file.

With cypress, I can run the full test suite by default, but it is also easy to run specific tests.

Thank you for considering this request.

kussmaul commented 1 month ago

I made a workaround. In pa11y-ci.conf.js, I moved urls from module.exports to a local variable, and instead call a function inside module.exports to pick matching entries. The first call matches all urls; the second matches urls that contain any of the strings.

  // urls : pickEntries(urls),
  // urls : pickEntries(urls, "#login", "/user/", "#logout", "#anon"),

This is the function:

var pickEntries = (urls, ... picks) =>
  (picks.length == 0) ? urls : picks.map((p) => urls.filter((u) => u.url.includes(p))).flat();

It would still be nice to choose urls from the command line, though. :-)