mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[cucumber] Update hooks to take options or a string for the tags
This commit is contained in:
@@ -32,6 +32,11 @@ function StepSample() {
|
||||
callback();
|
||||
});
|
||||
|
||||
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.status === "failed");
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll((callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
@@ -42,6 +47,11 @@ function StepSample() {
|
||||
callback();
|
||||
});
|
||||
|
||||
BeforeAll('@tag', (callback: Callback) => {
|
||||
console.log("Before all");
|
||||
callback();
|
||||
});
|
||||
|
||||
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
|
||||
if (scenarioResult.status === "failed") {
|
||||
runScenario(null, () => {
|
||||
@@ -60,6 +70,11 @@ function StepSample() {
|
||||
callback();
|
||||
});
|
||||
|
||||
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log("After");
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll((callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
@@ -70,6 +85,11 @@ function StepSample() {
|
||||
callback();
|
||||
});
|
||||
|
||||
AfterAll('@tag', (callback: Callback) => {
|
||||
console.log("After all");
|
||||
callback();
|
||||
});
|
||||
|
||||
registerHandler('AfterFeatures', (event: any, callback: () => void) => {
|
||||
callback();
|
||||
});
|
||||
|
||||
8
types/cucumber/index.d.ts
vendored
8
types/cucumber/index.d.ts
vendored
@@ -66,13 +66,13 @@ export interface HookOptions {
|
||||
|
||||
export interface Hooks {
|
||||
Before(code: HookCode): void;
|
||||
Before(options: HookOptions, code: HookCode): void;
|
||||
Before(options: HookOptions | string, code: HookCode): void;
|
||||
BeforeAll(code: GlobalHookCode): void;
|
||||
BeforeAll(options: HookOptions, code: GlobalHookCode): void;
|
||||
BeforeAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
After(code: HookCode): void;
|
||||
After(options: HookOptions, code: HookCode): void;
|
||||
After(options: HookOptions | string, code: HookCode): void;
|
||||
AfterAll(code: GlobalHookCode): void;
|
||||
AfterAll(options: HookOptions, code: GlobalHookCode): void;
|
||||
AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
|
||||
Around(code: AroundCode): void;
|
||||
setDefaultTimeout(time: number): void;
|
||||
// tslint:disable-next-line ban-types
|
||||
|
||||
Reference in New Issue
Block a user