Allow enhance() to be called multiple times #2

Open
wants to merge 1 commit into
from
View
@@ -40,11 +40,10 @@ MochaHooks = {
beforeEachHook.ctx = suite.ctx;
beforeEachHook.timeout(suite.timeout());
suite._beforeEach.unshift(beforeEachHook);
-
- MochaHooks._enhanced = true;
}
return runSuite.apply(this, arguments);
};
+ MochaHooks._enhanced = true;
},
/**
View
@@ -10,9 +10,11 @@ SinonMocha = {
enhance: function(sinon, mocha){
SinonMocha.sinon = sinon;
- Hooks.enhance(mocha);
- Hooks.beforeEach(SinonMocha.beforeEach);
- Hooks.afterEach(SinonMocha.afterEach);
+ if (!Hooks._enhanced) {
+ Hooks.enhance(mocha);
+ Hooks.beforeEach(SinonMocha.beforeEach);
+ Hooks.afterEach(SinonMocha.afterEach);
+ }
},
beforeEach: function(){