Convert data table values to intended data types #45

Closed
theycallmeswift opened this Issue Feb 17, 2012 · 1 comment

Projects

None yet

2 participants

@theycallmeswift

Right now the data table parser assumes everything is a string and users have to manually convert fields to Booleans, objects, arrays, etc. More than willing to help out on this if you can point me in the right direction.

I've traced it back to this line:

https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/type/hash_data_table.js#L33

It looks like Gherkin is actually converting everything to strings, so I'm not sure if that's a bug or something intentional.

@jbpros
Member
jbpros commented Feb 17, 2012

What you want is (table) transforms. It is intentional for (table) step arguments to be strings only: we can't implicitly infer what types to cast them to.

With transforms, one can tell Cucumber to process arguments before passing them to the matching step definition. The same applies to table transforms.

Transforms are not yet implemented in Cucumber.js.

If you're up to it, you can definitely work on it. Ping me if you need some guidance.

Closing this issue as it's a dupe of #13.

@jbpros jbpros closed this Feb 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment