From 5f41a2e4bdccf07eb3fe746250b17e1d73f68ae2 Mon Sep 17 00:00:00 2001 From: Vitaliy Potapov Date: Wed, 23 Oct 2024 11:10:35 +0400 Subject: [PATCH] refactor: rename StepDefinition.code to fn to be consistent with options --- src/gen/testFile.ts | 2 +- src/run/StepInvoker.ts | 2 +- src/steps/stepDefinition.ts | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gen/testFile.ts b/src/gen/testFile.ts index 35684525..d486648b 100644 --- a/src/gen/testFile.ts +++ b/src/gen/testFile.ts @@ -401,7 +401,7 @@ export class TestFile { // fixtures are accessible via this.world if (stepDefinition.isCucumberStyle()) return []; - return fixtureParameterNames(stepDefinition.code) // prettier-ignore + return fixtureParameterNames(stepDefinition.fn) // prettier-ignore .filter((name) => !isBddAutoInjectFixture(name)); } diff --git a/src/run/StepInvoker.ts b/src/run/StepInvoker.ts index 0ecd25a2..58caab4b 100644 --- a/src/run/StepInvoker.ts +++ b/src/run/StepInvoker.ts @@ -59,7 +59,7 @@ class StepInvoker { // some projects request it for better migration process from cucumber. // Here, for pw-style we pass empty object as world. // See: https://github.com/vitalets/playwright-bdd/issues/208 - return stepDefinition.code.call(this.bddContext.world, fixturesArg, ...parameters); + return stepDefinition.fn.call(this.bddContext.world, fixturesArg, ...parameters); }); } diff --git a/src/steps/stepDefinition.ts b/src/steps/stepDefinition.ts index 0cf9d242..8f2a9dc6 100644 --- a/src/steps/stepDefinition.ts +++ b/src/steps/stepDefinition.ts @@ -34,8 +34,7 @@ export class StepDefinition { return this.options.pattern; } - // todo: rename to fn to be consistent with options? - get code() { + get fn() { return this.options.fn; }