Skip to content

Instantly share code, notes, and snippets.

@chrisdickinson chrisdickinson/test.sh Secret
Last active Aug 29, 2015

Embed
What would you like to do?
#!/bin/bash
NODE=$1
shift
target=$1
VERSIONS="master v6.5.1 v6.4.0 v6.3.0 v6.2.2 v6.1.0 v6.0.2"
if [ ! -z "$target" ]; then
VERSIONS="$target"
fi
if [ -z "$NODE" ]; then
NODE="../../node-v0.10/node"
fi
echo "testing $VERSIONS against $NODE"
failed() {
echo -en "\033[31m$1\033[0m $2\n"
}
passed() {
echo -en "\033[32m$1\033[0m $2\n"
}
for version in $VERSIONS; do
printf 'testing %s... ' $version
result=$(git checkout --detach $version 2>&1)
if [ $? -ne 0 ]; then
failed 'fail' 'could not checkout'
exit 1
fi
printf 'rm node_modules... '
result=$(rm -rf node_modules)
if [ $? -ne 0 ]; then
failed 'fail' 'could not clear node_modules'
exit 1
fi
printf 'npm install... '
result=$(npm install 2>&1)
if [ $? -ne 0 ]; then
echo $?
failed 'fail' 'could not npm install'
exit 1
fi
printf 'node test... '
result=$($NODE node_modules/lab/bin/lab -t 100)
if [ $? -ne 0 ]; then
failed 'fail' 'FAILED TESTS!!'
echo $result
echo
exit 1
else
passed 'ok'
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.