mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
tests: busted: nvim handler: display durations always (#11075)
This shows them also with test failures/errors, where it is useful to see how long the test took (for flaky failures running into timeout).
This commit is contained in:
parent
81b19df5f2
commit
db6b4b677d
@ -227,8 +227,12 @@ return function(options)
|
|||||||
return nil, true
|
return nil, true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function write_status(element, string)
|
||||||
|
io.write(timeString:format(getElapsedTime(element)) .. ' ' .. string)
|
||||||
|
io.flush()
|
||||||
|
end
|
||||||
|
|
||||||
handler.testEnd = function(element, _parent, status, _debug)
|
handler.testEnd = function(element, _parent, status, _debug)
|
||||||
local elapsedTime_ms = getElapsedTime(element)
|
|
||||||
local string
|
local string
|
||||||
|
|
||||||
fileTestCount = fileTestCount + 1
|
fileTestCount = fileTestCount + 1
|
||||||
@ -241,45 +245,21 @@ return function(options)
|
|||||||
string = skippedString
|
string = skippedString
|
||||||
elseif status == 'failure' then
|
elseif status == 'failure' then
|
||||||
failureCount = failureCount + 1
|
failureCount = failureCount + 1
|
||||||
string = nil
|
string = failureString .. failureDescription(handler.failures[#handler.failures])
|
||||||
elseif status == 'error' then
|
elseif status == 'error' then
|
||||||
errorCount = errorCount + 1
|
errorCount = errorCount + 1
|
||||||
string = nil
|
string = errorString .. failureDescription(handler.errors[#handler.errors])
|
||||||
|
else
|
||||||
|
string = "unexpected test status! ("..status..")"
|
||||||
end
|
end
|
||||||
|
write_status(element, string)
|
||||||
|
|
||||||
if string ~= nil then
|
|
||||||
if elapsedTime_ms == elapsedTime_ms then
|
|
||||||
string = timeString:format(elapsedTime_ms) .. ' ' .. string
|
|
||||||
end
|
|
||||||
io.write(string)
|
|
||||||
io.flush()
|
|
||||||
end
|
|
||||||
|
|
||||||
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
|
return nil, true
|
||||||
end
|
end
|
||||||
|
|
||||||
handler.error = function(element, _parent, _message, _debug)
|
handler.error = function(element, _parent, _message, _debug)
|
||||||
if element.descriptor ~= 'it' then
|
if element.descriptor ~= 'it' then
|
||||||
io.write(failureDescription(handler.errors[#handler.errors]))
|
write_status(element, failureDescription(handler.errors[#handler.errors]))
|
||||||
io.flush()
|
|
||||||
errorCount = errorCount + 1
|
errorCount = errorCount + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -293,8 +273,6 @@ return function(options)
|
|||||||
busted.subscribe({ 'file', 'end' }, handler.fileEnd)
|
busted.subscribe({ 'file', 'end' }, handler.fileEnd)
|
||||||
busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
|
busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
|
||||||
busted.subscribe({ 'test', 'end' }, handler.testEnd, { 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({ 'failure' }, handler.error)
|
||||||
busted.subscribe({ 'error' }, handler.error)
|
busted.subscribe({ 'error' }, handler.error)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user