Skip to content

Instantly share code, notes, and snippets.

@mmalecki
Created November 9, 2012 01:18
Show Gist options
  • Select an option

  • Save mmalecki/4043108 to your computer and use it in GitHub Desktop.

Select an option

Save mmalecki/4043108 to your computer and use it in GitHub Desktop.
The only test runner you'll ever need
#!/bin/sh
echo "Running test suite"
for t in test/*-test.js; do
echo
echo "Running $t..."
output=`node $t`
code=$?
if [ $code -ne 0 ]; then
echo " $(tput setaf 1)$t failed (exit code: $code)$(tput sgr0)"
echo "Output:"
echo $output
exit 1
else
echo " $(tput setaf 2)$t OK$(tput sgr0)"
fi
done
@tj
Copy link

tj commented Nov 9, 2012

works even better if you use make targets, then you can -j 4

@mmalecki
Copy link
Author

mmalecki commented Nov 9, 2012

I'm a bit opposed to running tests in parallel, especially if they interact with DBs or services, but if it's good for your usecase that's a very good idea

@tj
Copy link

tj commented Nov 9, 2012

yeah that can get ugly, node stuff is usually fast enough anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment