twolfson / doubleshot

Run separated BDD outlines and content on Mocha
MIT License
1 stars 0 forks source link

Contemplate adding in isolation at the batch level #5

Closed twolfson closed 11 years ago

twolfson commented 11 years ago

It is kind of sloppy of mocha to not isolate batches (even at the hookup/hookdown), do we want to instrument and tweak this to use a chain style?

twolfson commented 11 years ago

It looks like there is a problem in doubleshot, not mocha, with respect to the top level batches. This test proves that mocha does not have cross-contamination.

https://github.com/twolfson/mocha/blob/8e11b56c94382dc7e6ec19a824f225ae734b362d/test/acceptance/batch.isolation.js

twolfson commented 11 years ago

Cross contamination still exists but you need to be quite aggressive with your this fallbacks to get it.

https://github.com/twolfson/mocha/blob/04ea54bc7772fd103d63532dcb66c1a77d07d199/test/acceptance/batch.isolation.js

twolfson commented 11 years ago

I think it would be very much appropriate. It seems to even span across multiple files but is very non-intuitive.

https://github.com/twolfson/mocha/blob/c1e8c924a87266bbd49d068647616943c8d9b159/test/acceptance/batch.isolation.js

https://github.com/twolfson/mocha/blob/c1e8c924a87266bbd49d068647616943c8d9b159/test/acceptance/batch.isolation2.js

twolfson commented 11 years ago

Arguing myself into this; it is necessary for modular code. We must enforce the module pattern at the batch level as it is expected behavior. If people try to break out, let them use the global scope on their own terms.

twolfson commented 11 years ago

Released in 2.3.0.