Creates easy to read HTML file from axe-coreĀ® accessibility results object
Installations
npm install axe-html-reporter
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=8.9.0
Node Version
18.20.1
NPM Version
10.5.0
Score
99.5
Supply Chain
100
Quality
81.3
Maintenance
100
Vulnerability
98.9
License
Releases
2.2.11 Patch
Updated on Sep 05, 2024
2.2.10 Minor improvement
Updated on Aug 22, 2024
v2.2.9 Bug fix for the 2.2.7 release
Updated on Aug 22, 2024
v2.2.7
Updated on Aug 21, 2024
v2.2.6
Updated on Aug 21, 2024
Released changes to comply with axe-coreĀ® trademark use
Updated on Jul 09, 2024
Contributors
Unable to fetch Contributors
Languages
HTML (98.21%)
TypeScript (1.72%)
JavaScript (0.06%)
Love this project? Help keep it running ā sponsor us today! š
Developer
lpelypenko
Download Statistics
Total Downloads
28,681,949
Last Day
23,286
Last Week
484,712
Last Month
1,902,614
Last Year
16,364,968
GitHub Statistics
MIT License
36 Stars
94 Commits
23 Forks
5 Watchers
12 Branches
5 Contributors
Updated on Feb 06, 2025
Bundle Size
11.42 kB
Minified
4.30 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.2.11
Package Id
axe-html-reporter@2.2.11
Unpacked Size
2.98 MB
Size
189.74 kB
File Count
38
NPM Version
10.5.0
Node Version
18.20.1
Published on
Sep 05, 2024
Total Downloads
Cumulative downloads
Total Downloads
28,681,949
Last Day
5.5%
23,286
Compared to previous day
Last Week
8.3%
484,712
Compared to previous week
Last Month
34%
1,902,614
Compared to previous month
Last Year
124.3%
16,364,968
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Peer Dependencies
1
Dev Dependencies
7
axe-html-reporter
Creates an HTML report from Axe-coreĀ® library AxeResults object listing violations, passes, incomplete and incompatible results.
Allows specifying report creation options: reportFileName
, outputDir
, outputDirPath
, projectKey
and customSummary
.
Notes:
customSummary
allows having html parametersoutputDirPath
allows specifying absolute path
Please check sample report output.
createHtmlReport
returns HTML content that can be additionally used for specific integrations.
If only HTML content needed, user can pass doNotCreateReportFile: true
to stop report file creation.
Suggestion on how to use this library if you don't need a report file but need only HTML it produces:
1const reportHTML = createHtmlReport({ 2 results: rawAxeResults, 3 options: { 4 projectKey: 'I need only raw HTML', 5 doNotCreateReportFile: true, 6 }, 7}); 8console.log('reportHTML will have full content of HTML file.'); 9// suggestion on how to create file by yourself 10if (!fs.existsSync('build/reports/saveReportHere.html')) { 11 fs.mkdirSync('build/reports', { 12 recursive: true, 13 }); 14} 15fs.writeFileSync('build/reports/saveReportHere.html', reportHTML);
Install
npm i -D axe-html-reporter
Usage
Example usage in TestCafe
To run TestCafe tests with Axe-coreĀ®, install testcafe, axe-core and @testcafe-community/axe:
1npm i -D axe-html-reporter testcafe axe-core @testcafe-community/axe
For TestCafe example add the following clientScript in your .testcaferc.json
config:
1{ 2 "clientScripts": [{ "module": "axe-core/axe.min.js" }] 3}
In the example bellow fileName
is not passed. If fileName
is not passed, HTML report will be created with default name accessibilityReport.html
in artifacts
directory.
See full TestCafe test example is bellow:
1import { runAxe } from '@testcafe-community/axe'; 2import { createHtmlReport } from 'axe-html-reporter'; 3 4fixture('TestCafe tests with Axe-coreĀ®').page('http://example.com'); 5 6test('Automated accessibility testing', async (t) => { 7 const axeContext = { exclude: [['select']] }; 8 const axeOptions = { 9 rules: { 10 'object-alt': { enabled: true }, 11 'role-img-alt': { enabled: true }, 12 'input-image-alt': { enabled: true }, 13 'image-alt': { enabled: true }, 14 }, 15 }; 16 const { error, results } = await runAxe(axeContext, axeOptions); 17 await t.expect(error).notOk(`axe check failed with an error: ${error.message}`); 18 // creates html report with the default file name `accessibilityReport.html` 19 createHtmlReport({ 20 results, 21 options: { 22 projectKey: 'EXAMPLE', 23 }, 24 }); 25});
Run TestCafe test:
1npx testcafe 2 Running tests in: 3 - Chrome 85.0.4183.121 / Linux 4 5 TestCafe tests with Axe-coreĀ® 6HTML report was saved into the following directory /Users/axe-demos/artifacts/accessibilityReport.html 7 ā Automated accessibility testing 8 9 10 1 passed (1s) 11
Example usage in any JS framework
1import { createHtmlReport } from 'axe-html-reporter'; 2 3(() => { 4 // creates html report with the default name `accessibilityReport.html` file 5 createHtmlReport({ results: 'AxeCoreResults' }); // full AxeResults object 6 // creates html report with the default name `accessibilityReport.html` file and all supported AxeResults values 7 createHtmlReport({ results: { violations: 'Result[]' } }); // passing only violations from axe.run output 8 // creates html report with the default name `accessibilityReport.html` file and adds url and projectKey 9 createHtmlReport({ 10 results: 'AxeCoreResults', 11 options: { projectKey: 'JIRA_PROJECT_KEY' }, 12 }); 13 // creates html report with the name `exampleReport.html` in 'axe-reports' directory and adds projectKey to the header 14 createHtmlReport({ 15 results: 'AxeCoreResults', 16 options: { 17 projectKey: 'JIRA_PROJECT_KEY', 18 outputDir: 'axe-core-reports', 19 reportFileName: 'exampleReport.html', 20 }, 21 }); 22 // creates html report with all optional parameters, saving the report into 'docs' directory with report file name 'index.html' 23 const customSummary = `Test Case: Full page analysis 24 <br>Steps:</br> 25 <ol style="margin: 0"> 26 <li>Open https://dequeuniversity.com/demo/mars/</li> 27 <li>Analyze full page with all rules enabled</li> 28 </ol>`; 29 createHtmlReport({ 30 results: 'AxeResults', 31 options: { 32 projectKey: 'DEQUE', 33 customSummary, 34 outputDir: 'docs', 35 reportFileName: 'index.html', 36 }, 37 }); 38})();
CommonJS
1const { createHtmlReport } = require('axe-html-reporter'); 2 3(() => { 4 // creates html report with the name `accessibilityReport.html` file 5 createHtmlReport({ results: { violations: 'Result[]' } }); 6})();

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 1/18 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 20 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to axe-html-reporter
cypress-axe-reporter
Simple reporter that integrates easily with Cypress and Cypress-Axe to output accessibility violations in a HTML format.
axe-reporter-html
Creates an HTML report from Axe results listing violations, passes, incomplete and incompatible results.
contrast-compass-axe-html-reporter
The module that allows you to create Contrast Compass enhanced, fully accessible HTML Report from raw accessibility aXe result object
axe-html-reporter-custom-template
The module that allows you to create HTML Report from raw accessibility aXe result object