Add new method to define custom worlds.

Introduced in cucumber.js v2.0.0-rc.4
This commit is contained in:
Kevin Drouvin 2017-02-12 19:27:53 +02:00
parent a01e02004b
commit b5d7793ebf
2 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,12 @@ function StepSample() {
var step = <cucumber.StepDefinitions>this;
var hook = <cucumber.Hooks>this;
hook.setWorldConstructor(function() {
this.visit = function(url: string, callback: Callback) {
callback(null, 'pending');
}
})
hook.Before(function(scenario: HookScenario, callback: Callback){
scenario.isFailed() && callback.pending();
});

1
cucumber/index.d.ts vendored
View File

@ -69,6 +69,7 @@ declare namespace cucumber {
After(code: HookCode): void;
Around(code: AroundCode):void;
setDefaultTimeout(time:number): void;
setWorldConstructor(world: () => void): void;
registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void;
registerListener(listener: EventListener): void;
}