abhinaba-ghosh / playwright-lighthouse

:performing_arts:: Playwright Lighthouse Audit
https://www.npmjs.com/package/playwright-lighthouse
MIT License
250 stars 28 forks source link

Add comparison error to result when error is ignored #28

Closed mgrybyk closed 2 years ago

mgrybyk commented 2 years ago

Introduce a way to distinguish if the comparison was successful or not to the results object.

Use case

const result = await playAudit({ 
  ...,
  ignoreError: true
})

// do something with the results object

// finally, fail the test in case of any error
if (result.comparisonError) {
  throw new Error(comparisonError)
}

This is very helpful because I can use result object data in case of both failure and success and don't have to perform comparison by myself one more extra time.

grybykm commented 2 years ago

@abhinaba-ghosh can you please review? Thanks in advance!

abhinaba-ghosh commented 2 years ago

Thanks for this update. The feature should be available in v2.2.2