treosh / lighthouse-ci-action

Audit URLs using Lighthouse and test performance with Lighthouse CI.
MIT License
1.15k stars 82 forks source link

static-dist-dir type action failed #84

Closed Berkmann18 closed 1 month ago

Berkmann18 commented 3 years ago

I'm running the action on a static dir and get the following error:

Started a web server on port 44475...
  Running Lighthouse 1 time(s) on http://localhost:44475/index.html
  Run #1...failed!
  Error: Lighthouse failed with exit code 1
      at ChildProcess.<anonymous> (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/@lhci/cli/src/collect/lighthouse-runner.js:103:21)
      at ChildProcess.emit (events.js:210:5)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
  Fri, 18 Jun 2021 21:02:37 GMT ChromeLauncher Waiting for browser.
  Fri, 18 Jun 2021 21:02:37 GMT ChromeLauncher Waiting for browser...
  Fri, 18 Jun 2021 21:02:38 GMT ChromeLauncher Waiting for browser.....
  Fri, 18 Jun 2021 21:02:38 GMT ChromeLauncher Waiting for browser.......
  Fri, 18 Jun 2021 21:02:39 GMT ChromeLauncher Waiting for browser.........
  Fri, 18 Jun 2021 21:02:39 GMT ChromeLauncher Waiting for browser...........
  Fri, 18 Jun 2021 21:02:40 GMT ChromeLauncher Waiting for browser.............
  Fri, 18 Jun 2021 21:02:40 GMT ChromeLauncher Waiting for browser...............
  Fri, 18 Jun 2021 21:02:41 GMT ChromeLauncher Waiting for browser.................
  Fri, 18 Jun 2021 21:02:41 GMT ChromeLauncher Waiting for browser.................✓
  Fri, 18 Jun 2021 21:02:41 GMT ChromeLauncher Killing Chrome instance 2616
  Runtime error encountered: perf.getEntriesByName is not a function
  TypeError: perf.getEntriesByName is not a function
      at Object.exports.stop (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/marky/lib/marky.cjs.js:55:24)
      at Function.timeEnd (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/lighthouse-logger/index.js:128:11)
      at Function.requireGatherers (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/lighthouse/lighthouse-core/config/config.js:819:9)
      at new Config (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/lighthouse/lighthouse-core/config/config.js:337:27)
      at generateConfig (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/lighthouse/lighthouse-core/index.js:60:10)
      at lighthouse (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/lighthouse/lighthouse-core/index.js:43:18)
      at runLighthouse (/home/runner/work/_actions/treosh/lighthouse-ci-action/v2/node_modules/lighthouse/lighthouse-cli/run.js:193:32)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
  Error: LHCI 'collect' has encountered a problem.

Here are the relevant files:

lighthouse.yaml

name: LH
on:
  pull_request:
    types: [opened, reopened, synchronize, ready_for_review]

jobs:
  static-dist-dir:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node
        uses: dcodeIO/setup-node-nvm@master
        with:
          node-version: node
      - run: |
          npm ci --ignore-scripts
          npm run setup
          npm run build
      - name: Run Lighthouse on urls and validate with lighthouserc
        uses: treosh/lighthouse-ci-action@v2
        with:
          configPath: './.github/lighthouserc.json'
          uploadArtifacts: true
      - name: Report
        uses: manrueda/lighthouse-report-action@master
        with:
          reports: '.lighthouseci'
          github-token: ${{ secrets.GITHUB_TOKEN }}
lighthouserc.json
{
  "ci": {
    "preset": "lighthouse:recommended",
    "assert": {
      "assertions": {
        "categories:performance": ["error", { "minScore": 0.5 }],
        "categories:accessibility": ["error", { "minScore": 0.7 }],
        "categories:best-practices": ["error", { "minScore": 0.85 }],
        "categories:seo": ["error", { "minScore": 0.8 }],
        "categories:pwa": ["error", { "minScore": 0.25 }]
      }
    },
    "collect": {
      "staticDistDir": "./packages/app/dist",
      "settings": {
        "chromeFlags": [
          "--enable-webgl2-compute-context",
          "--use-fake-device-for-media-stream",
          "--use-fake-ui-for-media-stream"
        ]
      }
    }
  }
}