             aFilter =
                 afterError: (callback) ->
                     callback()
-                    setTimeout ->
+                    setImmediate ->
+                        done()
+                before: ->
+                    setImmediate ->
+                        throw name: 'MyError'
+            controller =
+                afterError: -> expect().fail()
+                method: 'get'
+                filters: [aFilter]
+                get: -> expect().fail()
+
+            runner.run controller, 10000, (error) ->
+                expect(error.name).to.be 'MyError'
+
+        it 'should not call bFilter.afterError() if an exception occurs within the aFilter.before()', (done) ->
+            aFilter =
+                afterError: (callback) ->
+                    callback()
+                    setImmediate ->
                         done()
                     , 30
                 before: ->
-                    setTimeout ->
+                    setImmediate ->
                         throw name: 'MyError'
-                    , 10
-            controller =
-                afterError: -> expect.fail()
-                method: 'get'
-                filters: [aFilter]
-                get: -> expect.fail()
+            bFilter =
+                afterTimeout: -> expect().fail()
+            controller =
+                method: 'get'
+                filters: [aFilter, bFilter]
+                get: -> expect().fail()
 
             runner.run controller, 10000, (error) ->
                 expect(error.name).to.be 'MyError'
-
-        it 'should not call bFilter.afterError() if an exception occurs within the aFilter.before()', (done) ->
-            aFilter =
-                afterError: (callback) ->
-                    callback()
-                    setTimeout ->
-                        done()
-                    , 30
-                before: ->
-                    setTimeout ->
-                        throw name: 'MyError'
-                    , 10
-            bFilter =
-                afterTimeout: -> expect.fail()
-            controller =
-                method: 'get'
-                filters: [aFilter, bFilter]
-                get: -> expect.fail()
-
-            runner.run controller, 10000, (error) ->
-                expect(error.name).to.be 'MyError'

            instance =
                filters: []
                before: ->
                    setTimeout ->
                        throw beforeError
                    , 10
            runner.run instance, 10000, (e) ->
                expect(e).to.be beforeError
                done()

                before: ->
                    done()
            runner.run instance, 10000, ->
                expect().fail()

        it 'should call the after() callback if it is defined', (done) ->
            instance =
