twolfson / sculptor

Library for sculpting framework/language agnostic BDD tests
MIT License
1 stars 0 forks source link

Move away from topic chain and onto callback as parameter #10

Open twolfson opened 11 years ago

twolfson commented 11 years ago

While vows got the layout dead-on, the topic chain is clunky and this fares much better in battle.

Try out using the first parameter as a callback and indicator that a function is asynchronous (as done in mocha).

I am not sure how this will tie into TDD frameworks (e.g. qunit) which wrap require test.start and test.stop for async functionality. However, in that same bucket, some require test.expect which opens another can of worms.

twolfson commented 11 years ago

5 minute thought. This is not necessarily the conclusion.

By moving the the function (done) { paradigm, we are establishing the first parameter is the frameworks way to interact with the user. Similarly, this is becoming our contextual data store.

Since we are in JS, we can adapt the done parameter based on the engine. For instance, if the user wants to start using a TDD engine, we can write properties to done. However, for semantics sake, now we rename it test.

test still functions as an asynchronous callback, however in this TDD style, they are opting not to use it as that.

Instead, they can still use their utilities (e.g. test.done, test.expect, test.stop). This leads us into assuming that every test is asynchronous, however in these scenarios, we will require test.done or done itself to be invoked.

twolfson commented 11 years ago

Ugh, I think these thoughts belong with [Ensighten/crossbones][crossbones].

https://github.com/Ensighten/crossbones