Make async testing more convenient and reliable #331

Closed
jzaefferer opened this Issue Oct 17, 2012 · 5 comments

Comments

Projects
None yet
3 participants
Owner

jzaefferer commented Oct 17, 2012

Our stop()/start() API isn't the greatest. Yehuda had some ideas for making that more convenient, outlined here: https://gist.github.com/2138c7bf20da83e823e8

Worth noting as well: nodeunit passes in a test object to each test, where the test has to call test.done() in the end. Each test gets its own instance, so there's no risk of one async test bleeding into another, like it currently can happen in QUnit. We should look into providing something similar for QUnit.

Contributor

rwaldron commented Oct 17, 2012

ahem...

Yes +9001

Owner

Krinkle commented Oct 22, 2012

I implemented the pseudo-context pattern earlier this year for this very reason. The "assert" argument passed to the test functions would be an instance of a QUnit.Assert. And all its methods imply QUnit.start when using config.requireExpects and the last expected assertion is made. For cases where no expect is given and/or for clarity in code we would provide a no-arguments assert.start() that just continues like the global QUnit.start does now.

Owner

jzaefferer commented Oct 22, 2012

That's a good point. So make that argument a test-specific instance, and fail if stop/start isn't called on that same instance. asyncTest would use the instance's stop method...

Krinkle was assigned Nov 25, 2012

Owner

jzaefferer commented Jan 3, 2013

Some more ideas, baed on the assert argument to the test callback:

test(..., function(assert) { var done = assert.async(); ... done(); }
asyncTest(..., function(assert) { assert.done(); })
Owner

jzaefferer commented Feb 13, 2014

Replaced by #534

jzaefferer closed this Feb 13, 2014

Krinkle added the discarded label Feb 14, 2014

Krinkle removed this from the v2.0 milestone Feb 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment