From 786fb982ead2921ca7efeff325fd39db54a034e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Dyhrberg=20Thegler?= Date: Mon, 20 Nov 2017 11:52:03 +0100 Subject: [PATCH] Adds a bit of tests for new cucumber hooks --- types/cucumber/cucumber-tests.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/types/cucumber/cucumber-tests.ts b/types/cucumber/cucumber-tests.ts index 77760bd5ac..c71e827285 100644 --- a/types/cucumber/cucumber-tests.ts +++ b/types/cucumber/cucumber-tests.ts @@ -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(); });