Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Fixed hook timeouts. Closes #120

Tj Holowaychuk736ae41168f9
diff --git a/lib/suite.js b/lib/suite.js
index f3188fa5..2762d13d 100644
--- a/lib/suite.js
+++ b/lib/suite.js
@@ -117,6 +117,7 @@ Suite.prototype.timeout = function(ms){
Suite.prototype.beforeAll = function(fn){
var hook = new Hook('"before all" hook', fn);
hook.parent = this;
+ hook.timeout(this.timeout());
this._beforeAll.push(hook);
this.emit('beforeAll', hook);
return this;
@@ -133,6 +134,7 @@ Suite.prototype.beforeAll = function(fn){
Suite.prototype.afterAll = function(fn){
var hook = new Hook('"after all" hook', fn);
hook.parent = this;
+ hook.timeout(this.timeout());
this._afterAll.push(hook);
this.emit('afterAll', hook);
return this;
@@ -149,6 +151,7 @@ Suite.prototype.afterAll = function(fn){
Suite.prototype.beforeEach = function(fn){
var hook = new Hook('"before each" hook', fn);
hook.parent = this;
+ hook.timeout(this.timeout());
this._beforeEach.push(hook);
this.emit('beforeEach', hook);
return this;
@@ -165,6 +168,7 @@ Suite.prototype.beforeEach = function(fn){
Suite.prototype.afterEach = function(fn){
var hook = new Hook('"after each" hook', fn);
hook.parent = this;
+ hook.timeout(this.timeout());
this._afterEach.push(hook);
this.emit('afterEach', hook);
return this;