bencompton / jest-cucumber

Execute Gherkin scenarios in Jest
Apache License 2.0
657 stars 115 forks source link

Add support for rowsHash() #3

Open mjstelly opened 6 years ago

mjstelly commented 6 years ago

Cucumber's rowsHash() function transforms a data table into a JSON object. To maintain parity between cucumber and jest, it would be helpful for jest-cucumber to support that function. Currently, I have to hack a non-standard data table structure in my feature file from this

| firstName | Sara |
| lastName | Lee |

to this

| key | value |
| firstName | Sara |
| lastName | Lee |

and then transform it in the step:

    when('Sara provides account information:', userInfo => {
      const user = {};
      userInfo.forEach(({ key, value }) => (user[key] = value));
      userStore.updateUser(user);
    });

Although this way does the job, it is "non-canon". Folks familiar with cucumber won't understand why we didn't use rowsHash() instead.

bencompton commented 6 years ago

Sure, more idiomatic table handling would be nice. Thanks for bringing this to light.

manu1rock commented 2 years ago

Hello, this PBI is added but still shows in backlog. Is there any plan to include this? It would be helpful if this can be prioritized.

Thanks,