Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to run subset of urls from config file #246

Open
kussmaul opened this issue Aug 11, 2024 · 1 comment
Open

option to run subset of urls from config file #246

kussmaul opened this issue Aug 11, 2024 · 1 comment

Comments

@kussmaul
Copy link

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
Copy link
Author

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. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant