[tox]
envlist = py27, flake8, test, eslint, csslint, tidy

[testenv]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
sitepackages = true
whitelist_externals =
    py.test
deps =
    mock
    mopidy
    pytest
    pytest-capturelog
    pytest-cov
    pytest-xdist
    responses
install_command = pip install --allow-unverified=mopidy --pre {opts} {packages}
commands =
    py.test \
        --basetemp={envtmpdir} \
        --junit-xml=xunit-{envname}.xml \
        --cov=mopidy_musicbox_webclient --cov-report=term-missing \
        {posargs:tests/}

[testenv:flake8]
sitepackages = false
deps =
    flake8
    flake8-import-order
    pep8-naming
skip_install = true
commands = flake8 --show-source --statistics --max-line-length 120 {posargs:mopidy_musicbox_webclient tests}

[testenv:test]
sitepackages = false
whitelist_externals =
    /bin/bash
deps =
    nodeenv
skip_install = true
commands =
    - nodeenv --prebuilt {toxworkdir}/node_env
    bash -c '. {toxworkdir}/node_env/bin/activate; npm install; npm test'

[testenv:eslint]
sitepackages = false
whitelist_externals =
    /bin/bash
deps =
    nodeenv
skip_install = true
commands =
    - nodeenv --prebuilt {toxworkdir}/node_env
    bash -c '. {toxworkdir}/node_env/bin/activate; npm install; npm run eslint'

[testenv:csslint]
sitepackages = false
whitelist_externals =
    /bin/bash
deps =
    nodeenv
skip_install = true
commands =
    - nodeenv --prebuilt {toxworkdir}/node_env
    bash -c '. {toxworkdir}/node_env/bin/activate; npm install; npm run csslint'

[testenv:tidy]
sitepackages = false
whitelist_externals =
    /bin/bash
deps =
    nodeenv
skip_install = true
commands =
    - nodeenv --prebuilt {toxworkdir}/node_env
    bash -c '. {toxworkdir}/node_env/bin/activate; npm install; npm run tidy'
