Skip to content

armgit / mocha

Public Imported from GitHub
0

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

afterEach works for bdd style

James Carrfabc7f1eef91
diff --git a/lib/interfaces/bdd.js b/lib/interfaces/bdd.js
index bc35d89f..11dc777a 100644
--- a/lib/interfaces/bdd.js
+++ b/lib/interfaces/bdd.js
@@ -33,10 +33,17 @@ module.exports = function(suite){
* Do this before each example
*
*/
- context.before = function(fn){
+ context.beforeEach = function(fn){
suites[0].addSetup(fn);
};
+ /**
+ * Do this after each example
+ *
+ */
+ context.afterEach = function(fn){
+ suites[0].addTearDown(fn);
+ };
/**
* Describe a "suite" with the given `title`
* and callback `fn` containing nested suites