lpelypenko / axe-html-reporter

Creates easy to read HTML file from axe-core® accessibility results object
MIT License
30 stars 22 forks source link

Errors producing report #26

Closed fomnus closed 3 weeks ago

fomnus commented 8 months ago

Trying to run this and getting the following errros

(() => { const rawAxeResults = JSON.parse(readFileSync('myResults.json', 'utf8')) createHtmlReport({ results: { violations: [rawAxeResults] } }) })(); HTML report was not created due to the error Cannot read properties of undefined (reading 'length')

jsdev commented 2 months ago

@fomnus why don't you link to your whole code. where you are creating myresult.json file you should instead just create the report, you shouldn't need both. Also AI can likely help you as this is not an issue with createHtmlReport

lpelypenko commented 3 weeks ago

@fomnus I am not sure what is the content of your myResults.json but I think it will contain multiple layers of results, e.g violations, incomplete, etc.
I suggest to use following structure if you want to use raw json file:

        const rawAxeResults = require('./rawAxeResults.json');
        createHtmlReport({
            results: rawAxeResults,
            options: { outputDir: 'artifacts', reportFileName: 'reportFromRawAxeResults.html' },
        });

This is how raw results may look like: https://github.com/lpelypenko/axe-testcafe-demo/blob/main/testcafe/rawAxeResults.json

I will close the issue since it is not reproducible and author is not responsive.