paulirish / pwmetrics

Progressive web metrics at your fingertipz
Apache License 2.0
1.25k stars 74 forks source link

Extend API data returned in by pwmetrics #188

Open denar90 opened 6 years ago

denar90 commented 6 years ago

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?

denar90 commented 6 years ago

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,
            }
          }
        },
....