2015-09-27 11:03:31 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-01-12 17:57:53 +00:00
|
|
|
#
|
|
|
|
# ownCloud
|
|
|
|
#
|
|
|
|
# Run JS tests
|
|
|
|
#
|
|
|
|
# @author Vincent Petry
|
|
|
|
# @copyright 2014 Vincent Petry <pvince81@owncloud.com>
|
|
|
|
#
|
2014-09-09 15:12:20 +00:00
|
|
|
|
2022-01-17 14:45:29 +00:00
|
|
|
set -euo pipefail
|
2014-09-09 15:12:20 +00:00
|
|
|
|
2014-01-12 17:57:53 +00: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
|
|
|
|
|
2022-01-17 14:45:29 +00:00
|
|
|
# install test packages
|
|
|
|
mkdir -p "$PREFIX"
|
|
|
|
$NPM ci --prefix "$PREFIX" || exit 3
|
2014-01-12 17:57:53 +00:00
|
|
|
|
2017-01-06 12:33:18 +00:00
|
|
|
# create scss test
|
|
|
|
mkdir -p tests/css
|
2017-03-20 12:59:21 +00:00
|
|
|
for SCSSFILE in core/css/*.scss
|
|
|
|
do
|
|
|
|
FILE=$(basename $SCSSFILE)
|
2022-01-17 14:45:29 +00:00
|
|
|
printf "\$webroot:''; @import 'functions.scss'; @import 'variables.scss'; @import '${FILE}';" | ./build/node_modules/.bin/node-sass --include-path core/css/ > tests/css/${FILE}.css
|
2017-03-20 12:59:21 +00:00
|
|
|
done
|
2017-01-06 12:33:18 +00:00
|
|
|
|
2016-06-29 16:45:13 +00:00
|
|
|
KARMA="$PREFIX/node_modules/karma/bin/karma"
|
2014-01-12 17:57:53 +00:00
|
|
|
|
2022-01-17 14:45:29 +00:00
|
|
|
NODE_PATH='build/node_modules' KARMA_TESTSUITE="${1:-}" $KARMA start tests/karma.config.js --single-run
|
2014-01-12 17:57:53 +00:00
|
|
|
|