#!/usr/bin/env bash

output_file="compatibility.md"

# make NVM available in this test script
. "$HOME/.nvm/nvm.sh"

echo "# Compatibility" > "$output_file"

test() {
  echo "Testing with $1"
  nvm install $1
  nvm use $1

  rm -rf build
  rm -rf "$HOME/.node-gyp"
  rm -rf node_modules

  npm install

  if [[ $? == 0 ]]; then
    echo " - $1: ✅" >> "$output_file"
  else
    echo " - $1: ❌" >> "$output_file"
  fi
}

test "v0.10.40"
test "v0.11.16"
test "v0.12.7"
test "iojs-v2.5.0"
test "iojs-v3.3.1"
test "v4.0.0"
test "v4.1.0"
test "v4.1.1"
