parameters:
  name: ''
  queueName: ''

phases:
- phase: ${{ parameters.name }}
  queue:
    name: ${{ parameters.queueName }}
    demands:
    - npm
    - node.js
  steps:
  - task: NodeTool@0
    displayName: Use Node 8.x
    inputs:
      versionSpec: 8.x
      checkLatest: true

  - task: Npm@1
    displayName: npm install
    inputs:
      command: custom
      customCommand: install --unsafe-perms
      verbose: false

  - ${{ if eq(parameters.name, 'Linux') }}:
    - script: |
        cd '$(Build.SourcesDirectory)'

        export npm_package_engines_vscode='^1.19.0'
        node ./node_modules/vscode/bin/install

  - task: Npm@1
    displayName: npm build
    inputs:
      command: custom
      verbose: false
      customCommand: 'run build'

  - task: Npm@1
    displayName: npm test
    inputs:
      command: custom
      verbose: false
      customCommand: test

  # - task: Npm@1
  #   displayName: npm intTest
  #   inputs:
  #     command: custom
  #     verbose: false
  #     customCommand: 'run intTest'

  - task: Npm@1
    displayName: npm lint
    inputs:
      command: custom
      verbose: false
      customCommand: 'run lint'
