visionmedia / expresso

use mocha
http://visionmedia.github.com/expresso
759 stars 89 forks source link

Remove Polling for ASync Support & Watch Props Instead #114

Open mhemesath opened 13 years ago

mhemesath commented 13 years ago

I have a thought around removing polling for async support. Basically, the change is to immediately export all keys (test names) to be used for the test suite. Then asynchronously add the values (tests) as they are ready to be executed.

module.exports = {
   "Should run Async Test" : null
}

setTimeout(function(){
    exports['Should run Async Test'] = function(){
        assert.ok('wahoo');
    };
}, 100);

In order to for expresso to know when to execute the test, we can watch the properties of the keys the module exports right away using code similar to this: https://gist.github.com/175649.

This will also fix hanging issue that occurs when a test file exports no tests, as expresso won't be waiting on any keys to be set.

Thougths?

tj commented 13 years ago

even the current stuff i have for async exports is super hacky, database clients should just queue queries before they are connected

mhemesath commented 13 years ago

So are you going to deprecate support for async exports then?

tj commented 13 years ago

not any time soon but probably