2015-09-27 13:03:31 +02:00
|
|
|
#!/usr/bin/env bash
|
2014-01-12 18:57:53 +01:00
|
|
|
#
|
|
|
|
# ownCloud
|
|
|
|
#
|
|
|
|
# Run JS tests
|
|
|
|
#
|
|
|
|
# @author Vincent Petry
|
|
|
|
# @copyright 2014 Vincent Petry <pvince81@owncloud.com>
|
|
|
|
#
|
2014-09-09 17:12:20 +02:00
|
|
|
|
2014-09-12 15:42:50 +02:00
|
|
|
# set -e
|
2014-09-09 17:12:20 +02:00
|
|
|
|
2014-01-12 18:57:53 +01:00
|
|
|
NPM="$(which npm 2>/dev/null)"
|
|
|
|
PREFIX="build"
|
|
|
|
|
|
|
|
if test -z "$NPM"
|
|
|
|
then
|
|
|
|
echo 'Node JS >= 0.8 is required to run the JavaScript tests' >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# update/install test packages
|
|
|
|
mkdir -p "$PREFIX" && $NPM install --link --prefix "$PREFIX" || exit 3
|
|
|
|
|
2017-01-06 13:33:18 +01:00
|
|
|
# create scss test
|
|
|
|
mkdir -p tests/css
|
2017-03-20 13:59:21 +01:00
|
|
|
for SCSSFILE in core/css/*.scss
|
|
|
|
do
|
|
|
|
FILE=$(basename $SCSSFILE)
|
|
|
|
FILENAME="${FILE%.*}"
|
|
|
|
printf "@import 'variables.scss'; @import '${FILE}';" | ./build/bin/node-sass --include-path core/css/ > tests/css/${FILE}.css
|
|
|
|
done
|
2017-01-06 13:33:18 +01:00
|
|
|
|
2016-06-29 18:45:13 +02:00
|
|
|
KARMA="$PREFIX/node_modules/karma/bin/karma"
|
2014-01-12 18:57:53 +01:00
|
|
|
|
2014-01-27 21:15:21 +01:00
|
|
|
NODE_PATH='build/node_modules' KARMA_TESTSUITE="$1" $KARMA start tests/karma.config.js --single-run
|
2014-01-12 18:57:53 +01:00
|
|
|
|