You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

autotest-js.sh 830B

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 -euo pipefail
  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. # install test packages
  19. mkdir -p "$PREFIX"
  20. $NPM ci --prefix "$PREFIX" || exit 3
  21. # create scss test
  22. mkdir -p tests/css
  23. for SCSSFILE in core/css/*.scss
  24. do
  25. FILE=$(basename $SCSSFILE)
  26. printf "\$webroot:''; @import 'functions.scss'; @import 'variables.scss'; @import '${FILE}';" | ./build/node_modules/.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