Gathering detailed insights and metrics for axe-html-reporter
Gathering detailed insights and metrics for axe-html-reporter
Gathering detailed insights and metrics for axe-html-reporter
Gathering detailed insights and metrics for axe-html-reporter
Creates easy to read HTML file from axe-core® accessibility results object
npm install axe-html-reporter
2.2.11 Patch
Published on 05 Sept 2024
2.2.10 Minor improvement
Published on 22 Aug 2024
v2.2.9 Bug fix for the 2.2.7 release
Published on 22 Aug 2024
v2.2.7
Published on 21 Aug 2024
v2.2.6
Published on 21 Aug 2024
Released changes to comply with axe-core® trademark use
Published on 09 Jul 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
32 Stars
94 Commits
22 Forks
4 Watching
12 Branches
5 Contributors
Updated on 21 Nov 2024
HTML (98.21%)
TypeScript (1.72%)
JavaScript (0.06%)
Cumulative downloads
Total Downloads
Last day
-4.9%
70,102
Compared to previous day
Last week
2.4%
422,571
Compared to previous week
Last month
10.3%
1,781,585
Compared to previous month
Last year
114.9%
13,844,290
Compared to previous year
1
1
7
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 pathPlease 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);
npm i -D axe-html-reporter
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
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})();
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
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
Found 1/18 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
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 More