Closed nfreear closed 2 years ago
Hi,
To follow-up, I've answered one of my enhancement ideas ...
Point 3, Support for environment variables -- pa11y-ci
accepts configuration files as JSON or Javascript -- in either case they are required
by pa11y-ci. So, the following works.
/*!
Pa11y-ci Configuration.
Dynamically generate a '.pa11yci' JSON config object, using an environment variable.
*/
var defaults = {
standard: 'WCAG2AA',
timeout: 5000
// More ...
};
var urls = [
'${TEST_SRV}/page1.html?_ua=pa11y',
'${TEST_SRV}/page2.html?_ua=pa11y'
];
function myPa11yCiConfiguration () {
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 return a reference to it!
module.exports = myPa11yCiConfiguration();
Then call with:
export TEST_SRV=https://test.example.org # Or, set via Travis-CI user-interface.
pa11y-ci -c .pa11yci.conf.js
Yours,
Nick
Hi @nfreear, sorry for the wait on a reply for this. I think as these are separate issues it'd be good to have different GitHub issues opened for them :)
I'll also get your blog post added to the site when I get a spare moment, thanks for writing it!
Closing as per @rowanmanning's comment above.
Hi,
I'm loving and using
pa11y-ci
. Thank you to all contributors, and the pa11y team!I've got some suggestions and ideas, that I'd like some feedback on.
Then I may be able to implement them, and create a pull request ...
Suggest badges (via https://shields.io) in the documentation for use in READMEs to promote pa11y-ci, for example,
An
--init
or--defaults
flag.pa11y-ci --init
would interactively create a.pa11yci.json
file, rather likenpm init
pa11y-ci --defaults > .pa11yci.json
would dump a default configuration to file. (Example, https://gist.github.com/nfreear/785dce9698bcd9656b6d3fa5ffee9b47)Support for environment variables in
.pa11yci.json
files. Why? Useful when running tests on multiple URLs on a visible, but un-advertised test-server,Example,
Then,
Yours,
Nick
(FYI, I've recently blogged about my use of
pa11y-ci
.)