fix(test runner): handle nil in no-colors output handler #15679

Problem:
13748512f6 #15610 The no-colors codepath of the nvim.lua test output
handler does not handle nil, leading to weird symptoms if e.g. a test
has a syntax error:

    test/busted/outputHandlers/nvim.lua:105: attempt to concatenate a nil value

Solution:
Coerce to string in no-colors handler.
This commit is contained in:
Justin M. Keyes 2021-09-16 11:42:00 -07:00 committed by GitHub
parent d140d3bd33
commit 9d5d72c388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@ local pretty = require 'pl.pretty'
local global_helpers = require('test.helpers') local global_helpers = require('test.helpers')
-- Colors are disabled by default. #15610 -- Colors are disabled by default. #15610
local colors = setmetatable({}, {__index = function() return function(s) return s end end}) local colors = setmetatable({}, {__index = function() return function(s) return s == nil and '' or tostring(s) end end})
if os.getenv "TEST_COLORS" then if os.getenv "TEST_COLORS" then
colors = require 'term.colors' colors = require 'term.colors'
end end