Mike,

I'm confused on how that won't work is there a scenario I'm missing that I didn't test for?  Here is how I understood the code to work

The original code took a nil hash symbol (:env), and assigned it a hash ({"AUTOTEST" => "1"}).

at this point, options has some values in them, but nothing for env, hence:
options = options.merge(:env => {"AUTOTEST" => "1"}) if $stdout.tty?
takes the existing options hash and merges AUTOTEST => 1 into options[:env].

At this point, options[:env] has one value {AUTOTEST => 1}

With the change I made, if options[:env].nil? == true, we get the same result
options[:env].inspect = {AUTOTEST => 1}

If we use the --environment-variable '[option]' tag, AUTOTEST => 1 gets added to the existing env hash, much in the same way you did in lib/parallel_tests/test/runner.rb:53

So if we execute:parallel_cucumber -n 2 --environment-variable '_JAVA_OPTIONS=-Xmx2048m'
Then at this point options[:env].inspect = [{_JAVA_OPTIONS => -Xmx2048m} , {AUTOTEST => 1}]

I can send you some screen shots of the testing I did when I get to work tomorrow.

Also, I am used to Java unit testing but not ruby testing, hence why I did manual testing.  It may take me some time to understand how to write unit tests for ruby code.


________________________________
 From: Michael Grosser <notifications@github.com>
To: grosser/parallel_tests <parallel_tests@noreply.github.com> 
Cc: nightbeast <westlake_m@Yahoo.com> 
Sent: Thursday, September 12, 2013 9:09 PM
Subject: Re: [parallel_tests] Allow environment variables to be passed in to the command (#259)
 


In lib/parallel_tests/gherkin/runner.rb:
> @@ -8,7 +8,7 @@ class Runner < ParallelTests::Test::Runner
>        class << self
>          def run_tests(test_files, process_number, num_processes, options)
>            sanitized_test_files = test_files.map { |val| Shellwords.escape(val) }
> -          options = options.merge(:env => {"AUTOTEST" => "1"}) if $stdout.tty? # display color when we are in a terminal
> +          (options[:env] || {}).merge!("AUTOTEST" => "1") if $stdout.tty? # display color when we are in a terminal 
won't work -> (options[:env] ||= {}) please also add a test :)
—
Reply to this email directly or view it on GitHub.