Karma unit test job not terminating after successful run for ionic project in gitlab ci pipeline

Viewed 14

Below are commands that I am using to run unit test job including the commands in comments which I used to make it possible to terminate the job as soon as job completes successfully.

 image: trion/ng-cli-karma:latest

 before_script:
    # - apt-get --quiet update --yes
    # - export CHROME_BIN=/usr/bin/google-chrome 
     - npm ci --legacy-peer-deps

stages:
     - test

Test-job:
    stage: test
#Test job check one
   #image: trion/ng-cli-karma:latest
    tags:
     - ci
    # before_script: 
    #  - export CHROME_BIN=/usr/bin/google-chrome 
    #  - npm ci --legacy-peer-deps
    script:
     - echo "Hello, $GITLAB_USER_LOGIN! Your unit test job is started"
     #- npm ci --legacy-peer-deps
     #Run e2e test case
     #- npx wdio run wdio.conf.js
     #Run unit test case with added parameters
    #  - karma-start --single-run
    # - ng test --browsers=ChromeHeadless --watch=false --karma-config=karma.conf.js
    # - npm run test:ci
    # - npm run test
     - npm run test --browsers=ChromeHeadless --no-watch
     - echo "Test job done"
    #timeout: 2 h

When I am running the ng test command in my local then it terminates automatically after single run as I set singleRun property as true in karma.conf.js. But it does not have any impact on gitlab ci pipeline. Throws error "Job exceeded timelimit of 1 hour". Even though I am getting TOTAL:134 SUCCESS at the end.

Is there any way to terminate the test job run, maybe any command which can point to singleRun property of karma.conf.js.

0 Answers
Related