Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fix getting timeout from Context (close #1282)

Travis Jeffery1048141c55f0
diff --git a/lib/context.js b/lib/context.js
index e7138ba9..84440bef 100644
--- a/lib/context.js
+++ b/lib/context.js
@@ -36,6 +36,7 @@ Context.prototype.runnable = function(runnable){
*/
Context.prototype.timeout = function(ms){
+ if (arguments.length === 0) return this.runnable().timeout();
this.runnable().timeout(ms);
return this;
};
diff --git a/test/acceptance/context.js b/test/acceptance/context.js
index 0d39f141..add011bd 100644
--- a/test/acceptance/context.js
+++ b/test/acceptance/context.js
@@ -65,3 +65,9 @@ describe('Context Siblings', function(){
})
})
+
+describe('timeout()', function(){
+ it('should return the timeout', function(){
+ this.timeout().should.equal(200);
+ });
+});