Permalink
Browse files

Use .length to infer sync/async setup el al.

  • Loading branch information...
1 parent 5d161fe commit 51eb7ba5a6362f1456b7529da0b29d61af6acddb @5long committed Dec 8, 2010
Showing with 8 additions and 2 deletions.
  1. +7 −0 src/test_suite.js
  2. +1 −2 test/test_suite.js
View
@@ -82,6 +82,13 @@ function boundAsyncQueue(key) {
}, cb)
}
this[keyAdd] = function(fn) {
+ var oldFn = fn
+ if (fn.length == 1) {
+ fn = function wrapSync(fixture, done) {
+ oldFn.apply(this, arguments)
+ done()
+ }
+ }
this[keyQueue].push(fn)
}
}
View
@@ -23,9 +23,8 @@ theSuite.add(new Test(testDesc, function(test, fixture) {
}, 2)
}))
-theSuite.addSetup(function(fixture, done) {
+theSuite.addSetup(function(fixture) {
fixture.foo = "foo"
- done()
})
theSuite.addSetup(function(fixture, done) {

0 comments on commit 51eb7ba

Please sign in to comment.