Created
October 20, 2011 00:36
-
-
Save tj/1300101 to your computer and use it in GitHub Desktop.
tiny bash test runner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TESTS = $(shell find test/test.*.js) | |
test: | |
@./test/run.sh $(TESTS) | |
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo | |
for file in $@; do | |
printf "\033[90m ${file#test/}\033[0m " | |
node $file && printf "\033[36m✓\033[0m\n" | |
test $? -eq 0 || exit $? | |
done | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ make test | |
test.exports.js ✓ | |
test.socket.events.js ✓ | |
test.socket.js ✓ | |
test.socket.messages.js ✓ | |
test.socket.pub-sub.filter.js ✓ | |
test.socket.pub-sub.js ✓ | |
test.socket.req-rep.js ✓ | |
test.socket.req-rep.multiple.js ✓ | |
test.socket.sndmore.js ✓ |
one sec I'll add a make target example :D
I was rewriting express tests to use similar until I realized windows would be fucked haha. You can also do something like make TESTS=test/test.socket.*.js
or just node test/test.socket.js
, so even though it's stupid-simple it's kinda nice
Oh fuck ya, that shit is sexy (The $@
confused me, now I know what that means :p).
I'm gonna start using this over my lazy one-liner version: https://github.com/TooTallNate/create/blob/bd015233ca4ac6b7a3cd13c8d1ff0a45dc8f9340/package.json#L9
Hot!
You can get free parallel execution with this + make -j2 test
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
n00b question: How do I use this?