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
520 stars 63 forks source link

Can't redirect output to a file #93

Closed giuliastro closed 3 years ago

giuliastro commented 4 years ago

Hello, how do you redirect the output of pa11y-ci to a file? I am trying this way:

pa11y-ci --sitemap https://website.../page-sitemap.xml > test.txt

and this way:

pa11y-ci -s https://localeyes.com/page-sitemap.xml > test.txt

I can see the output on screen but all I get is empty files containing just the first line and nothing else:

Running Pa11y on XX URLs:

Thank you in advance.

stbth01 commented 4 years ago

When I tried from the terminal I was getting something similar to what you describe. However I was able to get a solid output by adding a script to package.json.

"access:ci": "pa11y-ci -j > 508_results.json"
aarongoldenthal commented 4 years ago

When not returning JSON output, pa11y-ci writes test execution status to stdout, but test failures to stderr. The redirect you have above only redirects stdout to the file, hence the results you see. To redirect both both stdout and stderr to the file, try:

pa11y-ci > pa11y-ci-results.txt 2>&1
josebolos commented 3 years ago

Thanks for creating this issue. It looks like this is now fixed, feel free to reopen the issue if not.