Skip to content

Instantly share code, notes, and snippets.

@nfreear nfreear/.pa11yci.conf.js
Last active Mar 7, 2018

What would you like to do?
Dynamically generate a 'pa11y-ci' JSON configuration object, using an environment variable |
Pa11y-ci Configuration.
Dynamically generate a '.pa11yci' JSON config object, using an environment variable.
© Nick Freear, 07-March-2018.
export TEST_SRV= # Or, set via Travis-CI UI.
pa11y-ci -c .pa11yci.conf.js
var config = {
defaults: {
screenCapture: './_pa11y-screen-capture.png',
standard: 'WCAG2AA',
ignore: [ 'notice' ],
timeout: 5000,
wait: 1500
urls: [
function myPa11yCiConfiguration (urls, defaults) {
console.error('Env:', process.env.TEST_SRV);
for (var idx = 0; idx < urls.length; idx++) {
urls[ idx ] = urls[ idx ].replace('${TEST_SRV}', process.env.TEST_SRV);
return {
defaults: defaults,
urls: urls
// Important ~ call the function, don't just return a reference to it!
module.exports = myPa11yCiConfiguration (config.urls, config.defaults);
// End config.

This comment has been minimized.

Copy link
Owner Author

commented Mar 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.