Adds a bit of tests for new cucumber hooks

This commit is contained in:
Asbjørn Dyhrberg Thegler
2017-11-20 11:52:03 +01:00
parent 85382afe95
commit 786fb982ea
+21 -1
View File
@@ -13,7 +13,7 @@ function StepSample() {
type Table = cucumber.TableDefinition;
type HookScenarioResult = cucumber.HookScenarioResult;
cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, Around, Before, registerHandler, Given, When, Then}) => {
cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => {
setWorldConstructor(function({attach, parameters}) {
this.attach = attach;
this.parameters = parameters;
@@ -32,6 +32,16 @@ function StepSample() {
callback();
});
BeforeAll((callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
console.log("Before all");
callback();
});
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
if (scenarioResult.status === "failed") {
runScenario(null, () => {
@@ -50,6 +60,16 @@ function StepSample() {
callback();
});
AfterAll((callback: Callback) => {
console.log("After all");
callback();
});
AfterAll({ timeout: 1000 }, (callback: Callback) => {
console.log("After all");
callback();
});
registerHandler('AfterFeatures', (event: any, callback: () => void) => {
callback();
});