# http://www.appveyor.com/docs/appveyor-yml

# Test against these versions of Node.js.
environment:
  matrix:
    - nodejs_version: "0.10"
    - nodejs_version: "0.12"
    - nodejs_version: "4"
    - nodejs_version: "6"

# Install scripts. (runs after repo cloning)
install:
  # Get the latest stable version of Node
  - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
  # Download and install latest npcap with WinPCap compatibility
  - node -e "var s=0;function go(u){require('https').get(u,function(r){if(s==3){return r.pipe(require('fs').createWriteStream('C:\\npcap.exe'))} var b='';r.on('data',function(d){b+=d}).on('end',function(){if(!s||s==2){++s;return go(r.headers.location)}else if(s==1){++s;return go('https://github.com'+/\/nmap\/npcap\/.+?\.exe/.exec(b)[0])}})})}go('https://github.com/nmap/npcap/releases/latest')"
  - start "" /WAIT C:\npcap.exe /winpcap_mode=yes /S /Q
  # Typical npm stuff.
  - IF %nodejs_version% LSS 1 npm -g install npm
  - IF %nodejs_version% LSS 1 set PATH=%APPDATA%\npm;%PATH%
  - set CL=-DDELAYIMP_INSECURE_WRITABLE_HOOKS
  - npm install

# Post-install test scripts.
test_script:
  # Output useful info for debugging.
  - node --version
  - npm --version
  # run tests
  - npm test

# Don't actually build.
build: off

# Set build version format here instead of in the admin panel.
version: "{build}"
