【问题标题】:NodeJS docker image to run Angular test in gitlab-ciNodeJS docker 镜像在 gitlab-ci 中运行 Angular 测试
【发布时间】:2021-10-04 10:11:57
【问题描述】:

当我尝试使用命令 npm run test运行测试时,我尝试使用 gitlab-ci 和节点 docker 映像构建一个小型 Angular 应用程序> 它失败并出现以下错误:

ERROR [launcher]: No binary for Chrome browser on your platform. Please, set "CHROME_BIN" env variable.

gitlab-ci.yml

stages:
- build

variables:
  NPM_CONFIG_REGISTRY: https://test.com/xx/api/npm/npm-all

build:
  stage: build
  image: node:12.9
  script:
    - npm install
    - npm run build:prod
    - npm run test
  tags:
    - DOCKER

在上面的代码中,npm run test 执行 ng test 按照 package.json 中的配置

我能够运行构建,但是当我运行测试时它会寻找 chrome 浏览器,我还尝试使用以下命令以无头方式运行测试,但导致相同的错误:

ng test --no-watch --browsers=ChromeHeadless

如何在此版本中添加 chrome 功能?

【问题讨论】:

    标签: gitlab-ci docker-image angular-test


    【解决方案1】:

    要么自己安装 Chrome,要么尝试现有的Docker image that already includes it

    【讨论】:

      猜你喜欢
      • 2019-08-03
      • 1970-01-01
      • 2021-09-28
      • 2015-10-24
      • 2018-08-23
      • 1970-01-01
      • 1970-01-01
      • 2014-07-07
      • 2019-10-17
      相关资源
      最近更新 更多