vscode/scripts/test.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2017-07-03 07:38:19 +00:00
2016-01-04 11:35:25 +00:00
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
# --disable-dev-shm-usage --use-gl=swiftshader: when run on docker containers where size of /dev/shm
# partition < 64MB which causes OOM failure for chromium compositor that uses the partition for shared memory
LINUX_EXTRA_ARGS="--disable-dev-shm-usage --use-gl=swiftshader"
2016-01-04 11:35:25 +00:00
fi
2016-05-10 14:42:47 +00:00
cd $ROOT
2016-05-10 14:15:48 +00:00
if [[ "$OSTYPE" == "darwin"* ]]; then
2016-08-09 15:56:05 +00: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 15:57:09 +00:00
CODE=".build/electron/$NAME"
fi
# Node modules
2017-11-16 09:47:02 +00:00
test -d node_modules || yarn
# Get electron
2019-10-16 09:15:43 +00:00
yarn electron
2016-01-04 11:35:25 +00:00
# Unit Tests
2017-07-03 09:45:11 +00:00
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; \
ELECTRON_ENABLE_LOGGING=1 \
"$CODE" \
2020-02-07 08:51:24 +00:00
test/unit/electron/index.js "$@"
2016-01-04 11:35:25 +00:00
else
cd $ROOT ; \
ELECTRON_ENABLE_LOGGING=1 \
"$CODE" \
test/unit/electron/index.js $LINUX_EXTRA_ARGS "$@"
2016-01-04 11:35:25 +00:00
fi