1
0

autotest-js.sh 739 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. #
  3. # ownCloud
  4. #
  5. # Run JS tests
  6. #
  7. # @author Vincent Petry
  8. # @copyright 2014 Vincent Petry <pvince81@owncloud.com>
  9. #
  10. # set -e
  11. NPM="$(which npm 2>/dev/null)"
  12. PREFIX="build"
  13. if test -z "$NPM"
  14. then
  15. echo 'Node JS >= 0.8 is required to run the JavaScript tests' >&2
  16. exit 1
  17. fi
  18. # update/install test packages
  19. mkdir -p "$PREFIX" && $NPM install --link --prefix "$PREFIX" || exit 3
  20. KARMA="$(which karma 2>/dev/null)"
  21. # If not installed globally, try local version
  22. if test -z "$KARMA"
  23. then
  24. KARMA="$PREFIX/node_modules/karma/bin/karma"
  25. fi
  26. if test -z "$KARMA"
  27. then
  28. echo 'Karma module executable not found' >&2
  29. exit 2
  30. fi
  31. NODE_PATH='build/node_modules' KARMA_TESTSUITE="$1" $KARMA start tests/karma.config.js --single-run