File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -133,14 +133,12 @@ def configure_output
133
133
134
134
output = options [ :out ] || Pact . configuration . output_stream
135
135
if options [ :format ]
136
- if options [ :format ] == 'json'
137
- # To avoid mixing JSON and logging, the output_stream will be set to the error_stream
138
- # in the pact-provider-verifier.
139
- # Send JSON to a file if configured, or straight to $stdout
140
- ::RSpec . configuration . add_formatter Pact ::Provider ::RSpec ::JsonFormatter , options [ :out ] || $stdout
141
- else
142
- ::RSpec . configuration . add_formatter options [ :format ] , output
143
- end
136
+ formatter = options [ :format ] == 'json' ? Pact ::Provider ::RSpec ::JsonFormatter : options [ :format ]
137
+ # Send formatted output to $stdout for parsing, unless a file is specified
138
+ output = options [ :out ] || $stdout
139
+ ::RSpec . configuration . add_formatter formatter , output
140
+ # Don't want to mess up the JSON parsing with INFO and DEBUG messages to stdout, so send it to stderr
141
+ Pact . configuration . output_stream = Pact . configuration . error_stream if !options [ :out ]
144
142
else
145
143
# Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
146
144
formatter_class = Pact ::RSpec . formatter_class
You can’t perform that action at this time.
0 commit comments