From ae1b3266a40e63173f80a09c9df5aca45059c580 Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Fri, 1 Apr 2016 22:43:50 +0530 Subject: [PATCH] Parsing beforeEach and afterEach Tests passed --- index-v1.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/index-v1.js b/index-v1.js index 2194ede..96a6b06 100644 --- a/index-v1.js +++ b/index-v1.js @@ -92,8 +92,16 @@ SimpleMocha.prototype.before = function( fn ){ SimpleMocha.prototype.after = function( fn ){ this.currentDescribeBlock.afterFn = mkAsyncFn( fn ); }; -SimpleMocha.prototype.beforeEach = function(){}; -SimpleMocha.prototype.afterEach = function(){}; + + +SimpleMocha.prototype.beforeEach = function( fn ){ + this.currentDescribeBlock.beforeEachFn = mkAsyncFn( fn ); +}; + + +SimpleMocha.prototype.afterEach = function( fn ){ + this.currentDescribeBlock.afterEachFn = mkAsyncFn( fn ); +}; SimpleMocha.DescribeBlock = DescribeBlock; @@ -105,8 +113,8 @@ SimpleMocha.load = function( fileName ){ var it = sm.it; var before = sm.before; var after = sm.after; - var beforeEach = sm.after; - var afterEach = sm.after; + var beforeEach = sm.beforeEach; + var afterEach = sm.afterEach; var code = fs.readFileSync( fileName, 'utf-8' );