GitLab gets stuck, hangs and doesn’t move on to the next job after running the
ng test command in Angular.
This is what the problematic
.gitlab-ci.yml file looks like:
test: stage: test script: - npm install - ng test
But this doesn’t work because once the tests are complete, the GitLab Runner is left hanging and doesn’t complete, terminate or move on the next job.
ng test runs in watch mode, which means that it won’t terminate after completing.
So the flag
--watch=false needs to be added when running
test: stage: test script: - npm install - ng test --watch=false
Now after running ng test, the GitLab Runner will terminate or move on to the next job once the tests complete/fail etc.