mfrachet / cypress-audit

⚡ Run Lighthouse and Pa11y audits directly in your E2E test suites
https://mfrachet.github.io/cypress-audit/
MIT License
351 stars 44 forks source link

Seeing invalid arguments compilation error with HTML Reports "Expected 0 arguments, but got 1." #231

Open Rahul-Todupunoori opened 9 months ago

Rahul-Todupunoori commented 9 months ago

We are trying to use cypress-audit/lighthouse, and we are trying to setup HTML reports for the lighthouse and see ts compilation errors for the lighthouseReport for invalid arguments.

cypress.config.ts

on('task', {
        lighthouse: lighthouse((lighthouseReport) => {
          writeFile('lighthouse.html', lighthouseReport.report, (error: any) => {
            error ? console.log(error) : console.log('Report created successfully');
          });
        }),
      });
      on('before:browser:launch', (_browser, launchOptions) => {
        prepareAudit(launchOptions);
      });

test code

cy.lighthouse(
      {
        performance: 20,
        accessibility: 100,
        'best-practices': 85,
        seo: 85,
        pwa: 100,
      },
      { disableStorageReset: false },
      {
        settings: { output: 'html' },
        extends: 'lighthouse:default',
      }
    );

Error message: Screenshot 2023-10-17 at 4 19 47 PM