language: android
dist: precise
android:
  components:
    # use the latest revision of Android SDK Tools
    - platform-tools
    - tools

    # Additional components
    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - addon-google_apis-google-19

    # Specify at least one system image,
    # if you need to run emulator(s) during your tests
    - sys-img-armeabi-v7a-android-22
env:
  global:
    - _FORCE_LOGS=1
    - DEVICE=android
    - MOCHA_TIMEOUT=360000
    - RECURSIVE=
    - START_EMU=1
    - ANDROID_EMU_NAME=test
    - ANDROID_EMU_TARGET=android-21
    - ANDROID_EMU_ABI=armeabi-v7a
  matrix:
    - TEST=unit RECURSIVE=--recursive START_EMU=0
    - TEST=functional
before_script:
  # node stuff
  - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
  - nvm install 6
  - node --version
  - npm --version
  - npm install appium-test-support # get the travis emu scripts

  # android stuff
  - android list targets
  - $(npm bin)/android-emu-travis-pre

  # npm stuff
  - npm install

  # make sure emulator started
  - $(npm bin)/android-emu-travis-post
script:
  - npm run lint && npm run mocha -- -t $MOCHA_TIMEOUT $RECURSIVE build/test/$TEST -g @skip-ci -i
after_success:
  - npm run coverage
