Change process.env variables to legal bash identifiers
reydelamirienda opened this issue · comments
Setting options through process.env['mocha-unfunk-<option_name>']
is very unpractical, since environment variables in bash can only contain letters, numbers and underscores. Dashes are not allowed.
I would change it to MOCHA_UNFUNK_STYLE
for example.
This feature was made originally to pass options to sub-processes from within Node (some test runners do that), where Node would copy the variables.
But nice to see this could be useful from BASH, I'll update this shortly.
I just pushed v0.2.3 to npm that supports this naming style. It is a basic case+dash translation to the regular same names:
process.env['mocha-unfunk-style'] = 'plain';
// now also works as:
process.env['MOCHA_UNFUNK_STYLE'] = 'plain';
// bonus option: snake_cased
process.env['mocha_unfunk_style'] = 'plain';
Awesome, thanks.