#!/bin/bash # Runs `meteor test-packages`. The tests run on a fresh isolated Mongo instance. set -euo pipefail if ! $(which "spacejam" >/dev/null 2>/dev/null) { echo "Couldn't find executable 'spacejam' - try installing the package from npm with 'sudo -H npm install -g spacejam'?" exit 1 } setvar SCRIPT_DIR = $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) cd $SCRIPT_DIR proc run_build { shell {cd "$SCRIPT_DIR/.." && make shell-env} cd $SCRIPT_DIR } setvar SKIP_BUILD = ""no"" proc handle_args { while getopts "f" opt { case (opt) { f { setvar SKIP_BUILD = ""yes"" } * { echo "You can add '-f' to skip the build step" exit 1 } } } } handle_args @ARGV if test "yes" != $SKIP_BUILD { run_build } setvar SETTINGS = $(mktemp) cat > $SETTINGS <<< """ { "public": { "buildstamp": "[local dev front-end]", "allowDemoAccounts": true, "allowDevAccounts": true, "allowUninvited": ${ALLOW_UNINVITED:-false}, "isTesting": true, "wildcardHost": "*.local.sandstorm.io" } } """ # Work-around for problem where Meteor's bundled npm prefers the system gyp # over its own bundled version, and the system gyp doesn't work. export PYTHONPATH=$("$SCRIPT_DIR/../find-meteor-dev-bundle.sh")/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib # To test interactively through a browser: #meteor test-packages --settings $SETTINGS ./packages/sandstorm-permissions # To test on the command line: exec spacejam test-packages --settings $SETTINGS ./packages/sandstorm-permissions