@@ -37,6 +37,7 @@ class Presets
3737 :test_tag_or => [ 'BEAKER_TEST_TAG_OR' ] ,
3838 :test_tag_exclude => %w[ BEAKER_EXCLUDE_TAG BEAKER_TEST_TAG_EXCLUDE ] ,
3939 :run_in_parallel => [ 'BEAKER_RUN_IN_PARALLEL' ] ,
40+ :color => 'BEAKER_COLOR' ,
4041 }
4142
4243 # Select all environment variables whose name matches provided regex
@@ -85,6 +86,18 @@ def format_found_env_vars(found_env_vars)
8586 end
8687 found_env_vars [ :run_in_parallel ] = found_env_vars [ :run_in_parallel ] . split ( ',' ) if found_env_vars [ :run_in_parallel ]
8788
89+ # NO_COLOR is handled manually since it has inverted logic (presence means no color)
90+ no_color_val = ENV [ 'NO_COLOR' ]
91+ beaker_color_val = found_env_vars [ :color ]
92+
93+ if beaker_color_val && !beaker_color_val . empty?
94+ found_env_vars [ :color ] = !/^(no|false)$/i . match? ( beaker_color_val )
95+ elsif no_color_val && !no_color_val . empty?
96+ found_env_vars [ :color ] = false
97+ else
98+ found_env_vars . delete ( :color )
99+ end
100+
88101 found_env_vars [ :pe_version_file_win ] = found_env_vars [ :pe_version_file ]
89102 found_env_vars
90103 end
@@ -98,7 +111,7 @@ def calculate_env_vars
98111 found = found . merge ( format_found_env_vars ( collect_env_vars ( ENVIRONMENT_SPEC ) ) )
99112 found [ :answers ] = select_env_by_regex ( '\\Aq_' )
100113
101- found . delete_if { |_key , value | value . nil? or value . empty? }
114+ found . delete_if { |_key , value | value . nil? or ( value . respond_to? ( : empty?) && value . empty? ) }
102115 found
103116 end
104117
0 commit comments