pwmetrics
pwmetrics copied to clipboard
Extend API data returned in by pwmetrics
After starting PWMertrics run, users are able to get data adapted and retrieved from Lighthouse. What if users might need to process expectations vs real results? Should we extend API with returned data included expectations mixed with real metrics values?
I've asked on twitter and couple people were interested. Other than that I think it will be handy to handle expectation erros manyally, probably stop CI process (since we don't throw exeption if expectations failed) or do smth other.
So I propose to extend object with result data and have smth like this:
'runs': [
{
'timings': [
{
'title': 'First Contentful Paint',
'id': 'firstContentfulPaint',
'timing': 3389,
'color': 'green',
'expectations': { // might be empty if not specified
'timings': {
'warn': '>=1500',
'error': '>=2000'
},
'result': {
'warn': true,
'error': false,
}
}
},
....