hiptest-publisher
hiptest-publisher copied to clipboard
Default parameters for Javascript
I wanted to fix this in #83 (or at least add it to my own Cucumber+ESModules language), but ripped it out before submitting the PR.
ES6 supports default parameters now, and so I copied down what other languages had templated like this:
lib/templates/javascript/parameter.hbs
{{{ underscore rendered_children.name }}}{{#if has_default_value? }} = {{{ rendered_children.default }}}{{/if}}
This kinda worked, in that I got default params for params that have a default value, but it looked like in practice has_default_value?
was truthy for every parameter, resulting in function signatures having empty string as the default for every parameter for which no default was actually defined in HipTest:
function iSignUp(user = "", password = "") {
// TODO: Implement action: do something
throw 'Not implemented';
}