vscode/scripts/test.sh

38 lines
825 B
Bash
Raw Normal View History

#!/bin/bash
2016-01-04 12:35:25 +01:00
2017-07-03 09:38:19 +02:00
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
2017-11-16 10:47:02 +01:00
test -d node_modules || yarn
# Get electron
2017-11-16 14:43:41 +01:00
node build/lib/electron.js || ./node_modules/.bin/gulp electron
2016-01-04 12:35:25 +01:00
# Unit Tests
export ELECTRON_ENABLE_LOGGING=1
2017-07-03 11:45:11 +02:00
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; \
"$CODE" \
test/electron/index.js "$@"
2016-01-04 12:35:25 +01:00
else
cd $ROOT ; \
"$CODE" \
test/electron/index.js "$@"
2016-01-04 12:35:25 +01:00
fi