mirror of
https://github.com/sandstorm-io/sandstorm.git
synced 2026-11-06 01:22:38 -05:00
Fixes #3188 Nothing of substance has really changed in the bodies of the tests themselves; they are the same except for some find & replace changes like: s/test.isTrue/chai.assert.isOk/g ...but they pass now. This also adds explicit imports & exports for the `SandstormPermissions` global, and adds a side-effect only import of another module to the tests. This was done now because: * Unless we pass `--full-app` to `meteor test`, meteor does not implicitly load all of our modules. * Passing `--full-app` runs into problems trying to start the smtp server on startup, because our code is written to assume it was passed FDs by the gateway, but `meteor test` is running it in a more conventional fashion. * It was easier to just fix the imports (which is what we want to do long term anyway) than to fight with `--full-app`. This also turns the tests back on in CI.
62 lines
1.3 KiB
Bash
Executable File
62 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Runs `meteor test`. The tests run on a fresh isolated Mongo instance.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
cd "$SCRIPT_DIR"
|
|
|
|
run_build() {
|
|
(cd "$SCRIPT_DIR/.." && make shell-env)
|
|
cd "$SCRIPT_DIR"
|
|
}
|
|
|
|
SKIP_BUILD="no"
|
|
handle_args() {
|
|
while getopts "f" opt; do
|
|
case $opt in
|
|
f)
|
|
SKIP_BUILD="yes"
|
|
;;
|
|
*)
|
|
echo "You can add '-f' to skip the build step"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
handle_args "$@"
|
|
|
|
if [ "yes" != "$SKIP_BUILD" ]; then
|
|
run_build
|
|
fi
|
|
|
|
SETTINGS=$(mktemp)
|
|
|
|
cat > $SETTINGS << __EOF__
|
|
{
|
|
"public": {
|
|
"buildstamp": "[local dev front-end]",
|
|
"allowDemoAccounts": true,
|
|
"allowDevAccounts": true,
|
|
"allowUninvited": ${ALLOW_UNINVITED:-false},
|
|
"isTesting": true,
|
|
"wildcardHost": "*.local.sandstorm.io"
|
|
}
|
|
}
|
|
__EOF__
|
|
|
|
# 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
|
|
|
|
# Terrible hack: Make capnp.node available to tests.
|
|
rm -f /tmp/node_modules
|
|
ln -s "$(dirname "$PWD")/node_modules" /tmp/node_modules
|
|
|
|
meteor test \
|
|
--once \
|
|
--driver-package=meteortesting:mocha \
|
|
--settings "$SETTINGS"
|