# 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: 'win1803'
strategy:
  matrix:
    node_8_x:
      node_version: 8.x
    node_9_x:
      node_version: 9.x
    node_10_x:
      node_version: 10.x
    node_11_x:
      node_version: 11.x

steps:
- task: NodeTool@0
  inputs:
    versionSpec: $(node_version)
  displayName: 'Install Node.js'

- script: |
    npm install -g npm@latest
  displayName: 'update npm'

- script: |
    npm install
  displayName: 'npm install'

- script: |
    npx mocha test --reporter mocha-junit-reporter
  displayName: 'test'

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: 'test-results.xml'
