# Node.js # Build a general Node.js project with npm. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript trigger: - master pool: vmImage: 'ubuntu-latest' # [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 steps: # [Use this step] To install vrest-ng-cli binary as a npm module - task: NodeTool@0 inputs: versionSpec: '10.x' displayName: 'Install Node.js' # NPM modules should be cached otherwise the install will be too slow # https://docs.microsoft.com/en-us/azure/devops/pipelines/caching/?view=azure-devops # since the username / user home directory are not available via system variables # (there is even an open question about it) # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops # just use "/home/vsts" for now - task: Cache@2 inputs: key: npm | $(Agent.OS) | package-lock.json path: /home/vsts/.npm restoreKeys: npm | $(Agent.OS) | package-lock.json displayName: Cache NPM packages # [Use this step] vrest-ng-cli binary should be cached - task: Cache@2 inputs: key: '"vrest-ng-cli-$(vrest_version)" | $(Agent.OS)' path: /home/vsts/.cache/vrest restoreKeys: '"vrest-ng-cli-$(vrest_version)" | $(Agent.OS)' displayName: Cache vrest-ng-cli binary # [Use this step] Install vrest-ng-cli as a npm module # Change version if you would like to install different version - script: npm install -g vrest-ng-cli@$(vrest_version) displayName: 'Install vrest-ng-cli' - script: npm ci displayName: 'Install NPM dependencies' - script: npm run start & displayName: 'Start the application server' # [Use this step] To run vREST NG written Tests - script: vrest-ng-cli run --projectdir=test/ddt-tests --logger=xunit displayName: 'Run vREST NG Tests' # [Use this step] To publish test results to azure pipelines - task: PublishTestResults@2 inputs: testResultsFormat: 'JUnit' testResultsFiles: 'vrest_logs/logs.xml' searchFolder: '$(System.DefaultWorkingDirectory)' # Optional condition: succeededOrFailed()