Using Scenario Outline title placeholder doesn't work with autoBindSteps
@bencompton
Hi Ben, It works well when I remove the placeholder from Scenario Outline title. Adding the code I used for reference. Thanks!!
//login.feature
Feature: Login
Scenario Outline: <element> test
When user is on home page
Then user verifies <element>
Examples:
| element |
| button |
| input |
//login.steps.js
const { loadFeatures, autoBindSteps } = require("jest-cucumber");
const { CommonSteps } = require("./common.steps");
const { LoginSteps } = require("./newLogin.steps");
const features = loadFeatures("/Users/techcloset/Desktop/JEST/login.feature");
autoBindSteps(features, [CommonSteps, LoginSteps]);
Error: at Object.<anonymous>.exports.checkThatFeatureFileAndStepDefinitionsHaveSameScenarios (node_modules/jest-cucumber/src/validation/scenario-validation.ts:111:15)
at Suite.<anonymous> (node_modules/jest-cucumber/src/feature-definition-creation.ts:291:9)
at Object.defineFeature (node_modules/jest-cucumber/src/feature-definition-creation.ts:286:5)
at node_modules/jest-cucumber/src/automatic-step-binding.ts:30:9
at Array.forEach (<anonymous>)
at autoBindSteps (node_modules/jest-cucumber/src/automatic-step-binding.ts:29:14)
at Object.<anonymous> (login.steps.js:5:1)
Thank you, was able to reproduce!
Fine👍 . No mention!
I also encountered the issue, so I had a look at the source, did some debugging, and found a quick fix by sheer luck. Please see the PR, I'm not sure if it's the right way, but it does not break any tests, so I guess it's fine (I also added a test for this scenario).
For the time being, if you require this functionality (like me) until the PR is accepted, you can install the dist branch (with built files) directly from github like so:
npm install Papooch/jest-cucumber#dist --save-dev
Hi, @bencompton, would you mind reviewing the PR if it's alright? We've been using my fork in production since, so it would be great to have it merged.