Commit 4c1ac17 Jose Alvarez
committed
1 parent 0e21241 commit 4c1ac17 Copy full SHA for 4c1ac17
File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ M.generator_factory = function(opts)
126
126
end
127
127
128
128
M .formatter_factory = function (opts )
129
- opts .ignore_errors = true
129
+ if opts .ignore_errors == nil then opts . ignore_errors = true end
130
130
opts .on_output = function (params , done )
131
131
local output = params .output
132
132
if not output then return done () end
Original file line number Diff line number Diff line change @@ -261,9 +261,12 @@ describe("helpers", function()
261
261
end )
262
262
263
263
describe (" formatter_factory" , function ()
264
- local opts = {key = " val" }
264
+ local opts
265
+ before_each (function ()
266
+ stub (helpers , " generator_factory" )
267
+ opts = {key = " val" }
268
+ end )
265
269
266
- before_each (function () stub (helpers , " generator_factory" ) end )
267
270
after_each (function ()
268
271
helpers .generator_factory :clear ()
269
272
helpers .generator_factory :revert ()
@@ -278,6 +281,14 @@ describe("helpers", function()
278
281
assert .truthy (helpers .generator_factory .calls [1 ].refs [1 ].on_output )
279
282
end )
280
283
284
+ it (" should not set ignore_errors when already set" , function ()
285
+ opts .ignore_errors = false
286
+ helpers .formatter_factory (opts )
287
+
288
+ assert .equals (helpers .generator_factory .calls [1 ].refs [1 ]
289
+ .ignore_errors , false )
290
+ end )
291
+
281
292
describe (" on_output" , function ()
282
293
local formatter_done = stub .new ()
283
294
after_each (function () formatter_done :clear () end )
You can’t perform that action at this time.
0 commit comments