image: node:9-alpine stages: - test # [Use this step] To define the vrest-ng-cli version to be downloaded variables: vrest_version: '2.1.0' #vrest-ng-cli version to be downloaded vrest_uversion: '2_1_0' #underscore variant of vrest-ng-cli version npm_config_cache: '$CI_PROJECT_DIR/.npm' VREST_CACHE_FOLDER: '$CI_PROJECT_DIR/cache/vrest' # Cache modules in between jobs cache: key: ${CI_COMMIT_REF_SLUG} paths: - .npm - node_modules - cache/vrest test: stage: test script: # update the npm to latest version - npm i npm@latest -g # install the project dependencies - npm ci # Start the application server - npm run start & - apk update && apk add ca-certificates && update-ca-certificates && apk --no-cache add openssl wget # download the vrest-ng-cli binary if cache doesn't exist - if [ -f $VREST_CACHE_FOLDER/vrest-ng-cli ]; then echo "vrest ng cli binary already cached."; else mkdir -p $VREST_CACHE_FOLDER && wget -O $VREST_CACHE_FOLDER/vrest-ng-cli -q https://github.com/Optimizory/vrest-ng-cli/releases/download/v$vrest_version/vrest_ng_cli_alpine_$vrest_uversion; fi # make the downloadable binary as executable - chmod u+x $VREST_CACHE_FOLDER/vrest-ng-cli # Execute the vREST NG tests - $VREST_CACHE_FOLDER/vrest-ng-cli run --projectdir=./test/ddt-tests --logger=xunit artifacts: when: always paths: - vrest_logs/logs.xml reports: junit: vrest_logs/logs.xml