Download and start ROS before running tests + Run all tests + Run using node4.4.7

This commit is contained in:
Søren Vind 2016-11-08 16:47:20 -08:00
parent 42cab3a95a
commit d5cd3d7266
4 changed files with 36 additions and 6 deletions

6
.gitignore vendored
View File

@ -110,3 +110,9 @@ local.properties
# Visual Studio Code
.vscode
tsconfig.json
# Tests
object-server-for-testing/
tests/realm-object-server/
vendor/sync
vendor/sync*

View File

@ -51,7 +51,8 @@
"nan": "^2.3.3",
"needle": "^1.3.0",
"node-pre-gyp": "^0.6.30",
"sync-request": "^3.0.1"
"sync-request": "^3.0.1",
"url-parse": "^1.1.7"
},
"devDependencies": {
"babel-eslint": "^6.0.4",

View File

@ -23,12 +23,34 @@ if [[ $TARGET = *-android ]]; then
export REALM_BUILD_ANDROID=1
fi
SERVER_PID=0
PACKAGER_OUT="$SRCROOT/packager_out.txt"
LOGCAT_OUT="$SRCROOT/logcat_out.txt"
download_server() {
sh ./scripts/download-object-server.sh
}
start_server() {
sh ./object-server-for-testing/start-object-server.command &
SERVER_PID=$!
}
stop_server() {
if [[ ${SERVER_PID} > 0 ]] ; then
kill ${SERVER_PID}
fi
}
cleanup() {
# Kill all child processes.
# Kill started object server
stop_server
# Kill all other child processes.
pkill -P $$ || true
# Kill react native packager
pkill node || true
rm -f "$PACKAGER_OUT" "$LOGCAT_OUT"
}
@ -58,8 +80,6 @@ start_packager() {
}
xctest() {
${SRCROOT}/scripts/reset-simulators.sh
local dest="$(xcrun simctl list devices | grep -v unavailable | grep -m 1 -o '[0-9A-F\-]\{36\}')"
if [ -n "$XCPRETTY" ]; then
xcodebuild -scheme "$1" -configuration "$CONFIGURATION" -sdk iphonesimulator -destination id="$dest" test | xcpretty -c --no-utf --report junit --output build/reports/junit.xml
@ -75,7 +95,7 @@ trap cleanup EXIT
# Use a consistent version of Node if possible.
if [ -s "${HOME}/.nvm/nvm.sh" ]; then
. "${HOME}/.nvm/nvm.sh"
nvm use 5.4.0 || true
nvm use 4.4.7 || true
fi
case "$TARGET" in
@ -154,6 +174,8 @@ case "$TARGET" in
cat tests.xml
;;
"node")
download_server
start_server
npm install --build-from-source
# Change to a temp directory.
@ -164,6 +186,7 @@ case "$TARGET" in
npm install
npm test
popd
stop_server
;;
"test-runners")
npm install --build-from-source

View File

@ -83,7 +83,7 @@ const readline = require("readline");
const tmp = require("tmp");
const userTests = require('../js/user-tests');
fdescribe('SyncTests', () => {
describe('SyncTests', () => {
beforeEach(() => Realm.clearTestState());
afterEach(() => Realm.clearTestState());