vscode/scripts/test.sh

41 lines
944 B
Bash
Raw Normal View History

2016-01-04 12:35:25 +01:00
#!/bin/bash
2016-01-12 16:59:22 +01:00
set -e
2016-01-04 12:35:25 +01:00
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
2016-05-10 16:42:47 +02:00
cd $ROOT
2016-05-10 16:15:48 +02:00
if [[ "$OSTYPE" == "darwin"* ]]; then
2016-08-09 17:56:05 +02:00
NAME=`node -p "require('./product.json').nameLong"`
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
else
NAME=`node -p "require('./product.json').applicationName"`
2016-08-09 17:57:09 +02:00
CODE=".build/electron/$NAME"
fi
# Node modules
test -d node_modules || ./scripts/npm.sh install
# Get electron
test -f "$CODE" || ./node_modules/.bin/gulp electron
# Build
test -d out || ./node_modules/.bin/gulp compile
2016-01-04 12:35:25 +01:00
# Unit Tests
2016-08-19 17:19:32 +02:00
export VSCODE_DEV=1
2016-01-04 12:35:25 +01:00
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; ELECTRON_RUN_AS_NODE=1 \
"$CODE" \
2016-08-26 11:52:21 +02:00
node_modules/mocha/bin/_mocha "$@"
2016-01-04 12:35:25 +01:00
else
cd $ROOT ; ELECTRON_RUN_AS_NODE=1 \
"$CODE" \
2016-08-26 11:52:21 +02:00
node_modules/mocha/bin/_mocha "$@"
2016-01-04 12:35:25 +01:00
fi