为了在Gitlab中使用管道,我创建了以下.gitlab-ci.yml文件:
image: node:8.2.1
cache:
paths:
- node_modules/
TestIt:
script:
- npm install
- '/node_modules/@angular/cli/bin/ng test --single-run=true --browsers PhantomJS --watch=false'
当跑步者开始工作时,它正在成功进行npm安装,但结束了 . 它没有继续到第二个脚本(就像它由于某种原因忽略它) .
这是输出:
可能是什么原因?
2 回答
我仍然没有找到发生这种情况的原因但是作为A workaround 经过长时间的搜索而不是使用
ng test
,我正在使用npm test
,就像这样:在
Karma.config.js
我从
autoWatch: true
更改为false
,从singleRun: false
更改为true
以防止连续测试 .我拿出
- npm install
如果你在Windows上,你可能遇到了这个问题(在“npm”命令后没有其他任何执行):
https://gitlab.com/gitlab-org/gitlab-runner/issues/2730
TL; DR:使用
call npm install
而不是npm install
,然后第二个命令也将执行 . 缺点:然后您的CI配置不再是平台独立的 .