Permalink
Browse files

[singletest] added functionality to run a single test

  • Loading branch information...
1 parent 3586530 commit eeb69a22786a762fcaa43fe9693cf05a80eebba1 @dscape committed Mar 24, 2012
Showing with 24 additions and 2 deletions.
  1. +1 −1 package.json
  2. +4 −0 specify.js
  3. +7 −1 test.sh
  4. +5 −0 test/fixtures/single.txt
  5. +7 −0 test/singletest.js
View
@@ -1,7 +1,7 @@
{ "name" : "specify"
, "description" : "bite sized node.js testing"
, "author" : "nuno job <nunojobpinto@gmail.com> (http://nunojob.com/)"
-, "version" : "0.3.3"
+, "version" : "0.4.0"
, "main" : "./specify.js"
, "homepage" : "https://github.com/dscape/specify"
, "repository" :
View
@@ -118,6 +118,10 @@ module.exports = (function specify() {
summary = def_summary;
};
spec.run = function run_all_tests(filter) {
+ if(typeof filter === "function") {
+ cache = [["main", filter]];
+ filter = [];
+ }
console.log();
console.log(" ", module.parent.filename.replace(process.cwd(), ""));
console.log();
View
@@ -2,11 +2,17 @@ node test/specify.js | sed 's/.\[[0-9][0-9]m//g' | sed 's/"at.*\(.*\)//' \
> test/all.log
node test/specify.js specify#throws specify#cascading_sync \
| sed 's/.\[[0-9][0-9]m//g' | sed 's/"at.*\(.*\)//' > test/filters.log
+node test/singletest.js | sed 's/.\[[0-9][0-9]m//g' > test/single.log
diff test/all.log test/fixtures/all.txt
if [ $? -eq 0 ]; then
diff test/filters.log test/fixtures/filters.txt
if [ $? -eq 0 ]; then
- echo "ok";
+ diff test/single.log test/fixtures/single.txt
+ if [ $? -eq 0 ]; then
+ echo "ok";
+ else
+ return -1;
+ fi
else
return -1;
fi
View
@@ -0,0 +1,5 @@
+
+ /test/singletest.js
+
+✔ 1/1 main
+✔ 1/1 summary
View
@@ -0,0 +1,7 @@
+var specify = require('../specify');
+
+specify.run(
+ function(assert) {
+ setTimeout(function () { assert.ok(true, "was true"); }, 1);
+ }
+);

0 comments on commit eeb69a2

Please sign in to comment.