Cucumber-js: Issue when migrating from 1.0.0 to 1.2.0

Created on 29 Jun 2016  ·  12Comments  ·  Source: cucumber/cucumber-js

Hello,

after cucumber version was updated i run into an issue and do not exactly understand how to fix it:

cucumber event handlers attached via registerHandler are now passed the associated object instead of an event
getPayloadItem will be removed in the next major release

C:dev\Topic Analyst\Frontend\node_modules\cucumber\lib\cucumber\runtime\event_broadcaster.js:30
throw error;
^
function accepts a callback and returns a promise

0 passing (3.30s)

[10:43:31] 'cucumber' errored after 3.51 s
[10:43:31] Error in plugin 'gulp-webdriver'
Message:
wdio exited with code 1

Any idea? Is this gulp-cucumber issue or...?

Most helpful comment

this is cucmber:

in one of your hooks or steps you've put a callback as a function parameter and then didnt call it:
e.g.

this.Before(function(scenario, callback) {
return something();
});

so if you return a promise, just get rid of "callback" as a parameter => function (scenario) {...}
or
just use your callback at the end: callback()

All 12 comments

this is cucmber:

in one of your hooks or steps you've put a callback as a function parameter and then didnt call it:
e.g.

this.Before(function(scenario, callback) {
return something();
});

so if you return a promise, just get rid of "callback" as a parameter => function (scenario) {...}
or
just use your callback at the end: callback()

no, we are not doing anything like that, instead we are hooking to gulp-cucumber ''beforeFeature" hook. This might be an issue. gulp-cucumber uses callback i suppose?

can you provide your beforeFeature code?

Can you get gulp to print a stacktrace? That way we might be able to nail down where the offending code is. The one recent change is now that registerHandler will throw a similar error as to what is described by @SkadeGlad.

I am afraid but this is all stack trace I see :(

@vytautas-pranskunas- can this be closed? Appears wdio-cucumber-framework has been updated

Yes. Thanks

Using cucumber-js 1.3.1, I get this warning:

cucumber event handlers attached via registerHandler are now passed the associated object instead of an event
getPayloadItem will be removed in the next major release

My hooks are:

var Hooks = function() {

  this.BeforeFeature(function (event, callback) {
    Context.feature = event.getPayloadItem('feature');
    callback();
  });

  this.BeforeScenario(function (event, callback) {
    Context.scenario = event.getPayloadItem('scenario');
    callback();
  });

  this.BeforeStep(function (event, callback) {
    Context.step = event.getPayloadItem('step');
    callback();
  });

};

What do I need to change ?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings