HTML report was not created due to the error violations.reduce is not a function

708 Views Asked by At

Hi i'm using the Axe html reporting tool for my script as seen here https://www.npmjs.com/package/axe-html-reporter

Using the code below im getting the error message in the subject title of this ticket.

Im not sure what the issue is?

const AxeBuilder = require('@axe-core/webdriverjs');
const WebDriver = require('selenium-webdriver');
const {By} = require("selenium-webdriver");
const driver = new WebDriver.Builder().forBrowser('chrome').build();
const { createHtmlReport } = require('axe-html-reporter');




(async function(){

    driver.get('https://www.skysports.com/the-hundred')

    // await driver.switchTo().frame(3)
    // await driver.findElement(By.css('button[title=\'Accept\']')).click()
    // await driver.manage().setTimeouts( { implicit: 1000 } )
        .then( () => {
            new AxeBuilder(driver).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'best-practice', 'wcag***', 'act', 'section508', 'section508.*.*', 'experimental', 'cat.*', 'color-contrast'])
                .analyze((err, results) => {
                    if (err) {
                        // Handle error somehow
                    }
                    (() => {
                        (() => {
                            // creates html report with the name `accessibilityReport.html` file
                            createHtmlReport({ results: { violations: 'Result[]' } });
                        })();

                    })();

                });
        });
}());
1

There are 1 best solutions below

0
On

Getting the same error... But createHtmlReport({ results }) seems to be working fine.