Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Named hooks in interfaces. Bugfixes #966.

Jacob Wejendorp157791f00210
diff --git a/lib/interfaces/bdd.js b/lib/interfaces/bdd.js
index 3a5b1ed6..e1581dab 100644
--- a/lib/interfaces/bdd.js
+++ b/lib/interfaces/bdd.js
@@ -33,32 +33,32 @@ module.exports = function(suite){
* Execute before running tests.
*/
- context.before = function(fn){
- suites[0].beforeAll(fn);
+ context.before = function(name, fn){
+ suites[0].beforeAll(name, fn);
};
/**
* Execute after running tests.
*/
- context.after = function(fn){
- suites[0].afterAll(fn);
+ context.after = function(name, fn){
+ suites[0].afterAll(name, fn);
};
/**
* Execute before each test case.
*/
- context.beforeEach = function(fn){
- suites[0].beforeEach(fn);
+ context.beforeEach = function(name, fn){
+ suites[0].beforeEach(name, fn);
};
/**
* Execute after each test case.
*/
- context.afterEach = function(fn){
- suites[0].afterEach(fn);
+ context.afterEach = function(name, fn){
+ suites[0].afterEach(name, fn);
};
/**
diff --git a/lib/interfaces/qunit.js b/lib/interfaces/qunit.js
index 30f6748f..a1150c36 100644
--- a/lib/interfaces/qunit.js
+++ b/lib/interfaces/qunit.js
@@ -41,32 +41,32 @@ module.exports = function(suite){
* Execute before running tests.
*/
- context.before = function(fn){
- suites[0].beforeAll(fn);
+ context.before = function(name, fn){
+ suites[0].beforeAll(name, fn);
};
/**
* Execute after running tests.
*/
- context.after = function(fn){
- suites[0].afterAll(fn);
+ context.after = function(name, fn){
+ suites[0].afterAll(name, fn);
};
/**
* Execute before each test case.
*/
- context.beforeEach = function(fn){
- suites[0].beforeEach(fn);
+ context.beforeEach = function(name, fn){
+ suites[0].beforeEach(name, fn);
};
/**
* Execute after each test case.
*/
- context.afterEach = function(fn){
- suites[0].afterEach(fn);
+ context.afterEach = function(name, fn){
+ suites[0].afterEach(name, fn);
};
/**
diff --git a/lib/interfaces/tdd.js b/lib/interfaces/tdd.js
index da5ca2c5..f5b78e00 100644
--- a/lib/interfaces/tdd.js
+++ b/lib/interfaces/tdd.js
@@ -41,32 +41,32 @@ module.exports = function(suite){
* Execute before each test case.
*/
- context.setup = function(fn){
- suites[0].beforeEach(fn);
+ context.setup = function(name, fn){
+ suites[0].beforeEach(name, fn);
};
/**
* Execute after each test case.
*/
- context.teardown = function(fn){
- suites[0].afterEach(fn);
+ context.teardown = function(name, fn){
+ suites[0].afterEach(name, fn);
};
/**
* Execute before the suite.
*/
- context.suiteSetup = function(fn){
- suites[0].beforeAll(fn);
+ context.suiteSetup = function(name, fn){
+ suites[0].beforeAll(name, fn);
};
/**
* Execute after the suite.
*/
- context.suiteTeardown = function(fn){
- suites[0].afterAll(fn);
+ context.suiteTeardown = function(name, fn){
+ suites[0].afterAll(name, fn);
};
/**