mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #15196 from isoung/master
cucumber: Added HookOptions as a 1st arg to Before/After hooks
This commit is contained in:
@@ -3,7 +3,7 @@ import cucumber = require("cucumber");
|
||||
|
||||
function StepSample() {
|
||||
type Callback = cucumber.CallbackStepDefinition;
|
||||
type Table = cucumber.TableDefinition;
|
||||
type Table = cucumber.TableDefinition;
|
||||
type HookScenario = cucumber.HookScenario;
|
||||
type Hooks = cucumber.Hooks;
|
||||
var step = <cucumber.StepDefinitions>this;
|
||||
@@ -19,6 +19,14 @@ function StepSample() {
|
||||
scenario.isFailed() && callback.pending();
|
||||
});
|
||||
|
||||
hook.Before({ timeout: 1000 }, function(scenario: HookScenario, callback: Callback) {
|
||||
callback();
|
||||
});
|
||||
|
||||
hook.After({ timeout: 1000 }, function(scenario: HookScenario, callback: Callback) {
|
||||
callback();
|
||||
});
|
||||
|
||||
hook.Around(function(scenario: HookScenario, runScenario: (error:string, callback?:Function)=>void) {
|
||||
scenario.isFailed() && runScenario(null, function(){
|
||||
console.log('finish tasks');
|
||||
|
||||
Vendored
+7
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for cucumber-js
|
||||
// Project: https://github.com/cucumber/cucumber-js
|
||||
// Definitions by: Abraão Alves <https://github.com/abraaoalves>, Jan Molak <https://github.com/jan-molak>
|
||||
// Definitions by: Abraão Alves <https://github.com/abraaoalves>, Jan Molak <https://github.com/jan-molak>, Isaiah Soung <https://github.com/isoung>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cucumber;
|
||||
@@ -70,9 +70,15 @@ declare namespace cucumber {
|
||||
typeName: string;
|
||||
}
|
||||
|
||||
interface HookOptions{
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
export interface Hooks {
|
||||
Before(code: HookCode): void;
|
||||
Before(options: HookOptions, code: HookCode): void;
|
||||
After(code: HookCode): void;
|
||||
After(options: HookOptions, code: HookCode): void;
|
||||
Around(code: AroundCode):void;
|
||||
setDefaultTimeout(time:number): void;
|
||||
setWorldConstructor(world: () => void): void;
|
||||
|
||||
Reference in New Issue
Block a user