From 2ee6ec8a0e4248dd0a606886bb179315efba9693 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 1 Feb 2018 18:23:51 -0500 Subject: [PATCH] support beforeEach; if condition for adding special functions --- src/testRunner.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/testRunner.js b/src/testRunner.js index 5bc69129a5..cb9e0ae4ab 100644 --- a/src/testRunner.js +++ b/src/testRunner.js @@ -8,11 +8,14 @@ function runTest(testName, testObject, testCallback, resultsCallback) { let availableFunctions = testObject._jsonInterface.filter((x) => x.type === 'function').map((x) => x.name); let testFunctions = testObject._jsonInterface.filter((x) => specialFunctions.indexOf(x.name) < 0 && x.type === 'function'); - if (availableFunctions.indexOf("beforeAll")) { + if (availableFunctions.indexOf("beforeAll") >= 0) { runList.push({name: 'beforeAll', type: 'internal', constant: false}); } for (let func of testFunctions) { + if (availableFunctions.indexOf("beforeEach") >= 0) { + runList.push({name: 'beforeEach', type: 'internal', constant: false}); + } runList.push({name: func.name, type: 'test', constant: func.constant}); }