Renan Bessa
Renan Bessa

Reputation: 449

Audit did not produce a value Cumulative Layout Shift in Lighthouse-CI

Audit did not produce a value Cumulative Layout Shift at all on all URLs on Bitbucket Pipeline. Received NaN

It does successfully execute the x runs on the other URLs, but it cannot produce a result. This only occurs when running it on BitBucket Pipeline.

I would expect a result to be generated for all x URLs passed in the lighthouserc.js

Lighthouserc.js

ci: {
    collect: {
      settings: {
        chromeFlags: '--no-sandbox --headless',
      },
      startServerCommand: 'yarn start',
      startServerReadyPattern: 'ready on',
      url: [
        'http://localhost:3000/calculadoras/calculadora-dias-uteis',
        'http://localhost:3000/cartao-de-credito/lista-de-cartoes',
        'http://localhost:3000/cartao-de-credito/comparador-de-cartoes',
        'http://localhost:3000/categoria/negocios',
      ],
      numberOfRuns: 3,
    },
    assert: {
      assertions: {
        'largest-contentful-paint': ['error', {maxNumericValue: 4000}],
        'cumulative-layout-shift': ['error', {maxNumericValue: 0.1}],
        'speed-index': ['error', {maxNumericValue: 5000}],
      },
    },
  },
}

Log BitbucketPipeline

1 result(s) for http://localhost:3000/calculadoras/calculadora-dias-uteis :
  ✘  cumulative-layout-shift failure for maxNumericValue assertion
       Cumulative Layout Shift
       https://web.dev/cls/
       Audit did not produce a value at all. "maxNumericValue" might not be a valid assertion for this audit.
        expected: <=0.1
           found: NaN
      all values: NaN, NaN, NaN
1 result(s) for http://localhost:3000/cartao-de-credito/comparador-de-cartoes :
  ✘  cumulative-layout-shift failure for maxNumericValue assertion
       Cumulative Layout Shift
       https://web.dev/cls/
       Audit did not produce a value at all. "maxNumericValue" might not be a valid assertion for this audit.
        expected: <=0.1
           found: NaN
      all values: NaN, NaN, NaN

Bitbucket-pipeline.yml

pull-requests:
    '**':
      - step:
          caches:
            - node
          name: Test and Build
          script:
            - yarn
            - yarn build
          artifacts:
            - .next/**
      - step:
          image: cypress/browsers:node14.15.0-chrome86-ff82
          caches:
            - node
          services:
            - docker
          name: Lighthouse Checks
          script:
            - yarn test:lighthouse

Upvotes: 1

Views: 131

Answers (0)

Related Questions