diff options
Diffstat (limited to 'test/busted/outputHandlers/nvim.lua')
-rw-r--r-- | test/busted/outputHandlers/nvim.lua | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/test/busted/outputHandlers/nvim.lua b/test/busted/outputHandlers/nvim.lua index 1b500fc999..5456e9ca98 100644 --- a/test/busted/outputHandlers/nvim.lua +++ b/test/busted/outputHandlers/nvim.lua @@ -196,7 +196,7 @@ return function(options) local tests = (testCount == 1 and 'test' or 'tests') local files = (fileCount == 1 and 'file' or 'files') io.write(globalTeardown) - io.write(global_helpers.read_nvim_log()) + io.write(global_helpers.read_nvim_log(nil, true)) io.write(suiteEndString:format(testCount, tests, fileCount, files, elapsedTime_ms)) io.write(getSummaryString()) io.flush() @@ -227,8 +227,12 @@ return function(options) return nil, true end + local function write_status(element, string) + io.write(timeString:format(getElapsedTime(element)) .. ' ' .. string) + io.flush() + end + handler.testEnd = function(element, _parent, status, _debug) - local elapsedTime_ms = getElapsedTime(element) local string fileTestCount = fileTestCount + 1 @@ -241,45 +245,21 @@ return function(options) string = skippedString elseif status == 'failure' then failureCount = failureCount + 1 - string = nil + string = failureString .. failureDescription(handler.failures[#handler.failures]) elseif status == 'error' then errorCount = errorCount + 1 - string = nil - end - - if string ~= nil then - if elapsedTime_ms == elapsedTime_ms then - string = timeString:format(elapsedTime_ms) .. ' ' .. string - end - io.write(string) - io.flush() + string = errorString .. failureDescription(handler.errors[#handler.errors]) + else + string = "unexpected test status! ("..status..")" end + write_status(element, string) return nil, true end - handler.testFailure = function(_element, _parent, _message, _debug) - io.write(failureString) - io.flush() - - io.write(failureDescription(handler.failures[#handler.failures])) - io.flush() - return nil, true - end - - handler.testError = function(_element, _parent, _message, _debug) - io.write(errorString) - io.flush() - - io.write(failureDescription(handler.errors[#handler.errors])) - io.flush() - return nil, true - end - handler.error = function(element, _parent, _message, _debug) if element.descriptor ~= 'it' then - io.write(failureDescription(handler.errors[#handler.errors])) - io.flush() + write_status(element, failureDescription(handler.errors[#handler.errors])) errorCount = errorCount + 1 end @@ -293,8 +273,6 @@ return function(options) busted.subscribe({ 'file', 'end' }, handler.fileEnd) busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending }) busted.subscribe({ 'test', 'end' }, handler.testEnd, { predicate = handler.cancelOnPending }) - busted.subscribe({ 'failure', 'it' }, handler.testFailure) - busted.subscribe({ 'error', 'it' }, handler.testError) busted.subscribe({ 'failure' }, handler.error) busted.subscribe({ 'error' }, handler.error) |