paulirish / pwmetrics

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

TypeError: Cannot read property 'timings' of undefined #200

Closed jooj123 closed 5 years ago

jooj123 commented 5 years ago

Config / CLI options / Steps to reproduce.

Have config:

const METRICS = require('pwmetrics/lib/metrics');

module.exports = {
  url:
    'http://localhost:3000/185-rosslyn-st-west-melbourne-vic-3003-99999999?test=true&disableads=true&notracking=true',
  flags: {
    runs: 1, 
    submit: false, 
    upload: false, 
    view: false, 
    expectations: true,
    chromeFlags: '--headless --no-sandbox',

  },
  expectations: {
    [METRICS.TTFCP]: {
      warn: '>=7189',
      error: '>=9000',
    },
    [METRICS.TTFMP]: {
      warn: '>=8387',
      error: '>=10000',
    },
    [METRICS.TTFCPUIDLE]: {
      warn: '>=8387',
      error: '>=10000',
    },
    [METRICS.TTI]: {
      warn: '>=8387',
      error: '>=10000',
    },
    [METRICS.SI]: {
      warn: '>=8387',
      error: '>=10000',
    },
  },
};

Stack trace

yarn run v1.10.1 $ pwmetrics --config=test/performance/pwmetrics-config.js Launching Chrome

                    │
        Speed Index │██████████████████████████████████████████████▊ 13,234
                    │
Time to Interactive │████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ 31,832
                    │
     First CPU Idle │███████▎ 2,044
                    │

First Meaningful Paint │███████▎ 2,044 │ First Contentful Paint │█████▌ 1,556 ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────── 0 Time (ms) since navigation start 32,000

✓ Success: Run 1 of 1 finished successfully. TypeError: Cannot read property 'timings' of undefined at PWMetrics.start (/Users/martin.jujou/Documents/projects/fe-server-search-results/node_modules/pwmetrics/lib/index.js:80:90) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Screenshot

Environment

  1. pwmetrics version: latest (^4.1.1)
  2. Chrome version: 71
  3. OS version: mac high sierra
jooj123 commented 5 years ago

Note: I know this is previously logged - but it says its fixed when its not

jooj123 commented 5 years ago

Also (not sure its part of same issue) it doesnt matter what warn or error values I put into expectations - it doesnt warn or error anymore with this latest version

denar90 commented 5 years ago

Error is fixed in v4.2.1. Regarding warn or error. Do you wanna pwmetrics throw it or just write in console?

error I got running example from recipe

 ✘ Error: First Meaningful Paint. Expected 2000 ms, but found 4080 ms.
  ✘ Error: First CPU Idle. Expected 2000 ms, but found 17461 ms.
  ✘ Error: Time to Interactive. Expected 8000 ms, but found 23552 ms.