Merge pull request #20 from ethereum/after_hooks

add afterEach and afterAll hooks
pull/7/head
yann300 6 years ago committed by GitHub
commit 7dfb3526d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/testRunner.js

@ -7,7 +7,7 @@ function getAvailableFunctions (jsonInterface) {
}
function getTestFunctions (jsonInterface) {
let specialFunctions = ['beforeAll', 'beforeEach']
let specialFunctions = ['beforeAll', 'beforeEach', 'afterAll', 'afterEach']
return jsonInterface.filter((x) => specialFunctions.indexOf(x.name) < 0 && x.type === 'function')
}
@ -25,6 +25,13 @@ function createRunList (jsonInterface) {
runList.push({name: 'beforeEach', type: 'internal', constant: false})
}
runList.push({name: func.name, type: 'test', constant: func.constant})
if (availableFunctions.indexOf('afterEach') >= 0) {
runList.push({name: 'afterEach', type: 'internal', constant: false})
}
}
if (availableFunctions.indexOf('afterAll') >= 0) {
runList.push({name: 'afterAll', type: 'internal', constant: false})
}
return runList

Loading…
Cancel
Save