When passing World
and other objects via this
you can run into issue with using arrow functions.
This rule catches any use of arrow functions to prevent errors caused by these objects being undefined on the this
instance inside the step definition.
This rule aims to catch any use of arrow functions when creating step definitions.
The following patterns are considered warnings:
Given(/some step/, () => {
this.currentEnvironment.username = 'Dr. Acula';
});
Given(/some step/, (done) => {
this.currentEnvironment.username = 'Dr. Acula';
});
Given(/some step/, (next) => {
this.currentEnvironment.username = 'Dr. Acula';
});
Given(/some step/, (callback) => {
this.currentEnvironment.username = 'Dr. Acula';
});
The following patterns are not warnings:
Given(/some step/, function () {
this.currentEnvironment.username = 'Dr. Acula';
});
Given(/some step/, function (done) {
this.currentEnvironment.username = 'Dr. Acula';
});
Given(/some step/, function (next) {
this.currentEnvironment.username = 'Dr. Acula';
});
Given(/some step/, function (callback) {
this.currentEnvironment.username = 'Dr. Acula';
});
When you're not using this
to pass in objects between steps.