File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -133,10 +133,13 @@ def configure_output
133
133
134
134
output = options [ :out ] || Pact . configuration . output_stream
135
135
if options [ :format ]
136
- ::RSpec . configuration . add_formatter options [ :format ] , output
137
- if !options [ :out ]
138
- # Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
139
- Pact . configuration . output_stream = Pact . configuration . error_stream
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
140
143
end
141
144
else
142
145
# Sometimes the formatter set in the cli.rb get set with an output of StringIO.. don't know why
You can’t perform that action at this time.
0 commit comments