运行期间 GitLab 发生中断

作者: chenfan0创建于 2024年4月24日更新于 2026年4月28日

lighthouserc.js

javascript
module.exports = {
  ci: {
    collect: {
      url: [
        'http://127.0.0.1:8089/',
      ],
      numberOfRuns: 3,
      startServerCommand: "PORT=8089 node src/server",
      settings: {
        hostname: '127.0.0.1',
        chromeFlags: ['--no-sandbox'],
      },
    },
    upload: {
      target: 'temporary-public-storage',
    }
  }
}
.GitLab-ci.yml
```yml
lhci:
  stage: test
  image: cypress/browsers:node-18.16.1-chrome-114.0.5735.133-1-ff-114.0.2-edge-114.0.1823.51-1
  script:   
    - npm install
    - npm install -g @lhci/[email protected]
    - npm run build
    - lhci autorun --config=./lighthouserc.js || echo "LHCI failed!"

内容来源: GoogleChrome/lighthouse-ci