2
0
mirror of https://github.com/koreader/koreader synced 2024-11-13 19:11:25 +00:00
koreader/spec/unit/verbose_print.lua

23 lines
643 B
Lua

-- from Mashape/kong/spec/busted-print.lua
local ansicolors = require 'ansicolors'
return function(options)
local handler = require 'busted.outputHandlers.utfTerminal'(options)
handler.fileStart = function(file)
io.write('\n' .. ansicolors('%{cyan}' .. file.name) .. ':')
end
handler.testStart = function(element, parent, status, debug)
io.write('\n ' .. handler.getFullName(element) .. ' ... ')
io.flush()
end
local busted = require 'busted'
busted.subscribe({ 'file', 'start' }, handler.fileStart)
busted.subscribe({ 'test', 'start' }, handler.testStart)
return handler
end