测试 lit-element 应用程序时出现 gitlab 错误

gitlab error in testing a lit-element app

我在我的项目中使用 Gitlab 作为 CI/CD 工具,我在尝试 运行 测试时遇到了这个错误:

> pwa-starter-kit@0.9.0 test:unit /builds/jperera84/prop-mgm-app
> polymer test --module-resolution=node --npm


Error: No browsers configured to run

error:  cli runtime exception: Error: No browsers configured to run error:  Error: No browsers configured to run
    at Object.<anonymous> (/builds/jperera84/prop-mgm-app/node_modules/polymer-cli/node_modules/web-component-tester/runner/config.js:518:19)
    at Generator.next (<anonymous>)
    at /builds/jperera84/prop-mgm-app/node_modules/polymer-cli/node_modules/web-component-tester/runner/config.js:20:71
    at new Promise (<anonymous>)
    at __awaiter (/builds/jperera84/prop-mgm-app/node_modules/polymer-cli/node_modules/web-component-tester/runner/config.js:16:12)
    at Object.validate (/builds/jperera84/prop-mgm-app/node_modules/polymer-cli/node_modules/web-component-tester/runner/config.js:506:12)
    at Object.<anonymous> (/builds/jperera84/prop-mgm-app/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:64:22)
    at Generator.next (<anonymous>)
    at fulfilled (/builds/jperera84/prop-mgm-app/node_modules/polymer-cli/node_modules/web-component-tester/runner/steps.js:4:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pwa-starter-kit@0.9.0 test:unit: `polymer test
--module-resolution=node --npm` npm ERR! Exit status 1 npm ERR!  npm ERR! Failed at the pwa-starter-kit@0.9.0 test:unit script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!     /root/.npm/_logs/2019-10-12T00_10_45_442Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pwa-starter-kit@0.9.0 test: `npm run test:unit && npm run test:integration` npm ERR! Exit status 1 npm ERR!  npm ERR! Failed at the pwa-starter-kit@0.9.0 test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!     /root/.npm/_logs/2019-10-12T00_10_45_483Z-debug.log ERROR: Job failed: exit code 1

我查看了一些关于此的文档,但我还没有找到配置我的 .gitlab-ci.yml 以正常工作的方法:

这是我的 .gitlab-ci.yml 文件:

image: node:latest

variables:
  LAUNCHPAD_FIREFOX: /usr/local/bin/firefox
  LAUNCHPAD_CHROME: /usr/bin/chromium-browser

stages:
  - build
  - test

cache:
  paths:
    - node_modules/

install_dependencies:
  stage: build
  script:
    - npm install
  artifacts:
    paths:
      - node_modules/

testing_integration:
  stage: test
  script:
    - npm run test

这是一个 Lit-Element 项目,基本上 运行 入门套件。

谁能帮我找到一个可行的解决方案?

谢谢

看来您需要构建自己的映像。从 node:latest 开始(基于 Debian)并添加 Chromium/Firefox.