autotest-js.sh 846 B

12345678910111213141516171819202122232425262728293031323334353637
  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 ci --link --prefix "$PREFIX" || exit 3
  20. # create scss test
  21. mkdir -p tests/css
  22. for SCSSFILE in core/css/*.scss
  23. do
  24. FILE=$(basename $SCSSFILE)
  25. FILENAME="${FILE%.*}"
  26. printf "\$webroot:''; @import 'functions.scss'; @import 'variables.scss'; @import '${FILE}';" | ./build/bin/node-sass --include-path core/css/ > tests/css/${FILE}.css
  27. done
  28. KARMA="$PREFIX/node_modules/karma/bin/karma"
  29. NODE_PATH='build/node_modules' KARMA_TESTSUITE="$1" $KARMA start tests/karma.config.js --single-run